npm install && npm run build' ); ?>

* @since 1.1.0 */ public static function get_disabled_abilities(): array { return AbilitiesState::disabled(); } /** * Whether the compiled DataViews bundle is present. * * @return bool * @since 1.3.0 */ private static function build_exists(): bool { return file_exists( ALBERT_PLUGIN_DIR . 'assets/build/js/abilities.asset.php' ); } /** * Enqueue admin assets for this page only. * * Reads the wp-scripts asset manifest (dependencies + version) emitted to * assets/build/js/abilities.asset.php. @wordpress/* deps load from core's * registered handles; @wordpress/dataviews is bundled into the script and its * stylesheet is shipped as assets/build/css/dataviews.css. Our authored styles * live in assets/css/admin-abilities.css. Bails quietly if the build is absent * (render_page shows the build notice in that case). * * @param string $hook Current admin page hook. * * @return void * @since 1.1.0 */ public function enqueue_assets( string $hook ): void { if ( 'albert_page_' . self::PAGE_SLUG !== $hook ) { return; } $asset_file = ALBERT_PLUGIN_DIR . 'assets/build/js/abilities.asset.php'; if ( ! file_exists( $asset_file ) ) { return; } $asset = require $asset_file; $version = $asset['version'] ?? ALBERT_VERSION; // Component chrome (Button, ToggleControl, …). wp_enqueue_style( 'wp-components' ); // DataViews ships its own stylesheet and core registers no handle for it, // so we ship the vendor copy emitted by the build (CopyWebpackPlugin). $dataviews_css = ALBERT_PLUGIN_DIR . 'assets/build/css/dataviews.css'; $has_dataviews_css = file_exists( $dataviews_css ); if ( $has_dataviews_css ) { wp_enqueue_style( 'albert-dataviews', ALBERT_PLUGIN_URL . 'assets/build/css/dataviews.css', [ 'wp-components' ], $version ); } // Our authored screen styles, loaded last so they can override the above. wp_enqueue_style( 'albert-abilities', ALBERT_PLUGIN_URL . 'assets/css/admin-abilities.css', $has_dataviews_css ? [ 'albert-dataviews' ] : [ 'wp-components' ], ALBERT_VERSION ); wp_enqueue_script( 'albert-abilities-app', ALBERT_PLUGIN_URL . 'assets/build/js/abilities.js', $asset['dependencies'] ?? [], $version, true ); wp_add_inline_script( 'albert-abilities-app', 'window.albertAbilities = ' . wp_json_encode( [ // REST root for this controller; the app builds its paths from // here rather than hardcoding the namespace in JS. api-fetch // wires the REST root URL and wp_rest nonce automatically. 'restBase' => Plugin::rest_namespace() . '/abilities', ] ) . ';', 'before' ); } }