query( 'wp-dataviews' ) && file_exists( $dataviews_css ) ) { wp_enqueue_style( 'ai-dataviews', WPAI_PLUGIN_URL . 'build/admin/dataviews.css', array(), (string) filemtime( $dataviews_css ) ); } Asset_Loader::enqueue_script( self::ASSET_HANDLE, self::ASSET_PATH ); Asset_Loader::enqueue_style( self::ASSET_HANDLE, self::ASSET_PATH ); // WordPress only loads DataViews' strings in block-editor contexts. wp_set_script_translations( 'wp-dataviews', 'default' ); Asset_Loader::localize_script( self::ASSET_HANDLE, 'AbilitiesExplorer', array( 'rest' => array( 'nonce' => wp_create_nonce( 'wp_rest' ), 'root' => esc_url_raw( rest_url() ), 'routes' => array( 'abilities' => Abilities_Controller::ABILITIES_ROUTE, 'item' => Abilities_Controller::ITEM_ROUTE, 'invoke' => Abilities_Controller::INVOKE_ROUTE, ), ), 'pageSlug' => self::PAGE_SLUG, 'providerLabels' => Ability_Handler::get_provider_labels(), ) ); } /** * Outputs the root DOM node the React application mounts into. * * @since 0.2.0 * @since 1.5.0 Renders only the React root. */ public function render_page(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } echo '
' . esc_html__( 'Abilities are a standardized way for WordPress core, plugins, and themes to expose discrete units of functionality. Each ability has a name, optional input/output schemas, and can be invoked programmatically.', 'ai' ) . '
' . '' . esc_html__( 'The Abilities Explorer lets you browse every registered ability, inspect its schemas, and test it with custom input right from the admin.', 'ai' ) . '
', ) ); $provider_tags = array( 'strong' => array() ); $screen->add_help_tab( array( 'id' => 'abilities-providers', 'title' => esc_html__( 'Providers', 'ai' ), 'content' => '' . esc_html__( 'Every ability is associated with a provider that indicates where it comes from:', 'ai' ) . '
' . '' . esc_html__( 'You can test any ability directly from this screen:', 'ai' ) . '
' . '' . esc_html__( 'For more information:', 'ai' ) . '
' . '' ); } }