関数
OrderEdit::init()
Loads assets and registers hooks for order edit page
戻り値 戻り値
ファイル: src/Admin/OrderEdit.php
public function init() { add_filter('usces_filter_settle_info_field_meta_keys', [$this, 'filterSettlementInfoTableMetaKeys'], 10, 1); add_filter('usces_filter_settle_info_field_keys', [$this, 'filterSettlementInfoTableKeys'], 10, 1); $enqueue = function () { // phpcs:disable WordPress.WP.I18n.NonSingularStringLiteralText $currency = __(usces_crcode('return'), 'usces'); try { $order = new OrderMeta($_REQUEST['order_id']); $currency = __($order->getPaymentCurrency(), 'usces'); } catch (InvalidArgumentException $e) { // not an Amazon Pay V2 order... return; } // phpcs:enable $semantic = new Semantic(); $semantic->loadDimmerCss(); $semantic->loadLoaderCss(); $semantic->loadToastCss(); $semantic->loadTransitionCss(); $semantic->loadSegmentCss(); $semantic->loadSemanticJS(); $semantic->loadMessageCss(); $slug = 'amazon-settlement-actions'; SettlementModulesUtils::loadTransactionStatesCss(); wp_enqueue_script( $slug, WCEXAAP_PLUGIN_URL . '/dist/settlementInfo.js', [], WCEXAAP_VERSION, true ); wp_localize_script($slug, AmazonPay::L10N, array_merge( $this->module->getScriptInjectionVariables(), [ 'orderId' => $_REQUEST['order_id'], 'currency' => $currency, 'chargeStateMap' => Charge\State::$stateMap, 'refundStateMap' => Refund\State::$stateMap, ] )); wp_set_script_translations($slug, 'wcexaap', WCEXAAP_LANGDIR); }; $this->loadMyModuleAssets($enqueue); return $this; }