当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Payment_Gateway::get_method_description方法代码示例

本文整理汇总了PHP中WC_Payment_Gateway::get_method_description方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Payment_Gateway::get_method_description方法的具体用法?PHP WC_Payment_Gateway::get_method_description怎么用?PHP WC_Payment_Gateway::get_method_description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Payment_Gateway的用法示例。


在下文中一共展示了WC_Payment_Gateway::get_method_description方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare_item_for_response

 /**
  * Prepare a payment gateway for response.
  *
  * @param  WC_Payment_Gateway $gateway    Payment gateway object.
  * @param  WP_REST_Request    $request    Request object.
  * @return WP_REST_Response   $response   Response data.
  */
 public function prepare_item_for_response($gateway, $request)
 {
     $order = (array) get_option('woocommerce_gateway_order');
     $item = array('id' => $gateway->id, 'title' => $gateway->title, 'description' => $gateway->description, 'order' => isset($order[$gateway->id]) ? $order[$gateway->id] : '', 'enabled' => 'yes' === $gateway->enabled, 'method_title' => $gateway->get_method_title(), 'method_description' => $gateway->get_method_description(), 'settings' => $this->get_settings($gateway));
     $context = !empty($request['context']) ? $request['context'] : 'view';
     $data = $this->add_additional_fields_to_object($item, $request);
     $data = $this->filter_response_by_context($data, $context);
     $response = rest_ensure_response($data);
     $response->add_links($this->prepare_links($gateway, $request));
     /**
      * Filter payment gateway objects returned from the REST API.
      *
      * @param WP_REST_Response   $response The response object.
      * @param WC_Payment_Gateway $gateway  Payment gateway object.
      * @param WP_REST_Request    $request  Request object.
      */
     return apply_filters('woocommerce_rest_prepare_payment_gateway', $response, $gateway, $request);
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:25,代码来源:class-wc-rest-payment-gateways-controller.php


注:本文中的WC_Payment_Gateway::get_method_description方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。