Automattic\WooCommerce\Internal\Admin\EmailPreview
EmailPreviewRestController::get_args_for_save_transient()
Get the accepted arguments for the POST save-transient request.
Метод класса: EmailPreviewRestController{}
Хуков нет.
Возвращает
Массив[]
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_args_for_save_transient();
Код EmailPreviewRestController::get_args_for_save_transient() EmailPreviewRestController::get args for save transient WC 9.6.0
private function get_args_for_save_transient() { return array( 'key' => array( 'required' => true, 'type' => 'string', 'description' => 'The key for the transient. Must be one of the allowed options.', 'validate_callback' => function ( $key ) { if ( ! in_array( $key, EmailPreview::get_all_email_settings_ids(), true ) ) { return new \WP_Error( 'woocommerce_rest_not_allowed_key', sprintf( 'The provided key "%s" is not allowed.', $key ), array( 'status' => 400 ), ); } return true; }, 'sanitize_callback' => 'sanitize_text_field', ), 'value' => array( 'required' => true, 'type' => 'string', 'description' => 'The value to be saved for the transient.', 'validate_callback' => 'rest_validate_request_arg', 'sanitize_callback' => function ( $value, $request ) { $key = $request->get_param( 'key' ); if ( 'woocommerce_email_footer_text' === $key || preg_match( '/_additional_content$/', $key ) ) { return wp_kses_post( trim( $value ) ); } return sanitize_text_field( $value ); }, ), ); }