関数
Item::load( int $post_id )
パラメータ パラメータ
- $post_id
(数値) (必須)
ファイル: src/Admin/Pages/Item/Item.php
public function load($post_id) {
// scripts
wp_enqueue_script('jquery-ui-sortable');
$assetsmap = include(WCEXICS_DIST_JS_DIR . '/Admin/Pages/Item/App.asset.php');
wp_enqueue_script(
self::SCRIPT_SLUG,
WCEXICS_DIST_JS_URL . '/Admin/Pages/Item/App.js',
array_merge($assetsmap['dependencies'], ['jquery-ui-sortable']),
$assetsmap['version'],
true
);
Snackbar::load([self::SCRIPT_SLUG]);
// styles
Loader::loadCoreCss();
/**
* It's unclear how you are supposed to load the admin theme for components that are used
* outside of the block editor... so we just load the `wp-block-editor` styles so that the
* admin theme is correctly applied to our components.
*
* IS THERE NO WAY TO DO THIS GUTENBERG???
*/
wp_enqueue_style('wp-block-editor');
wp_enqueue_style('wp-components');
wp_enqueue_style(
self::SCRIPT_SLUG,
WCEXICS_PLUGIN_URL . '/src/Admin/Pages/Item/combo-set-app.css',
[],
WCEXICS_VERSION
);
// injections
wp_set_script_translations(self::SCRIPT_SLUG, 'wcexics', WCEXICS_LANG_DIR);
wp_localize_script(
self::SCRIPT_SLUG,
'wcexics',
array_merge(
[
'multiSelectText' => __('Multi-select', 'usces'),
'requiredText' => __('Required', 'usces'),
'skuCodeText' => __('SKU code', 'usces'),
'skuDisplayNameText' => __('SKU display name ', 'usces'),
'currencySymbol' => __('dollars', 'usces'),
'welitems' => Utils::getAllPublishedWelcartItems(),
'combos' => API\ComboSet::getAllComboSetsForPostId($post_id),
'postId' => $post_id,
'domElements' => DomElementIdentifiers::getConstantsMap(),
],
$this->master->getScriptInjectionVariables()
)
);
}