本文整理汇总了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);
}