= 5.3 ) { $classes .= ' acf-admin-5-3'; } else { $classes .= ' acf-admin-3-8'; } // Add browser for specific CSS. $classes .= ' acf-browser-' . esc_attr( acf_get_browser() ); // Return classes. return $classes; } /** * Adds custom functionality to "ACF" admin pages. * * @date 7/4/20 * @since 5.9.0 * * @param void * @return void */ public function current_screen( $screen ) { // Determine if the current page being viewed is "ACF" related. if ( isset( $screen->post_type ) && in_array( $screen->post_type, acf_get_internal_post_types(), true ) ) { add_action( 'in_admin_header', array( $this, 'in_admin_header' ) ); add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); add_filter( 'update_footer', array( $this, 'admin_footer_version_text' ) ); $this->setup_help_tab(); $this->maybe_show_import_from_cptui_notice(); } } /** * Sets up the admin help tab. * * @date 20/4/20 * @since 5.9.0 * * @param void * @return void */ public function setup_help_tab() { $screen = get_current_screen(); // Overview tab. $screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview', 'acf' ), 'content' => '

' . __( 'Overview', 'acf' ) . '

' . '

' . __( 'The Advanced Custom Fields plugin provides a visual form builder to customize WordPress edit screens with extra fields, and an intuitive API to display custom field values in any theme template file.', 'acf' ) . '

' . '

' . sprintf( __( 'Before creating your first Field Group, we recommend first reading our Getting started guide to familiarize yourself with the plugin\'s philosophy and best practises.', 'acf' ), acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'help-tab' ) ) . '

' . '

' . __( 'Please use the Help & Support tab to get in touch should you find yourself requiring assistance.', 'acf' ) . '

' . '', ) ); // Help tab. $screen->add_help_tab( array( 'id' => 'help', 'title' => __( 'Help & Support', 'acf' ), 'content' => '

' . __( 'Help & Support', 'acf' ) . '

' . '

' . __( 'We are fanatical about support, and want you to get the best out of your website with ACF. If you run into any difficulties, there are several places you can find help:', 'acf' ) . '

' . '', ) ); // Sidebar. $screen->set_help_sidebar( '

' . __( 'Information', 'acf' ) . '

' . '

' . sprintf( __( 'Version %s', 'acf' ), ACF_VERSION ) . '

' . '

' . __( 'View details', 'acf' ) . '

' . '

' . __( 'Visit website', 'acf' ) . '

' . '' ); } /** * Shows a notice to import post types and taxonomies from CPTUI if that plugin is active. * * @since 6.1 */ public function maybe_show_import_from_cptui_notice() { global $plugin_page; // Only show if CPTUI is active and post types are enabled. if ( ! acf_get_setting( 'enable_post_types' ) || ! is_plugin_active( 'custom-post-type-ui/custom-post-type-ui.php' ) ) { return; } // No need to show on the tools page. if ( 'acf-tools' === $plugin_page ) { return; } $text = sprintf( /* translators: %s - URL to ACF tools page. */ __( 'Import Post Types and Taxonomies registered with Custom Post Type UI and manage them with ACF. Get Started.', 'acf' ), acf_get_admin_tools_url() ); acf_add_admin_notice( $text, 'success', true, true ); } /** * Renders the admin navigation element. * * @date 27/3/20 * @since 5.9.0 * * @param void * @return void */ function in_admin_header() { acf_get_view( 'global/navigation' ); $screen = get_current_screen(); if ( isset( $screen->base ) && 'post' === $screen->base ) { acf_get_view( 'global/form-top' ); } do_action( 'acf/in_admin_header' ); } /** * Modifies the admin footer text. * * @date 7/4/20 * @since 5.9.0 * * @param string $text The current admin footer text. * @return string */ public function admin_footer_text( $text ) { $wp_engine_link = acf_add_url_utm_tags( 'https://wpengine.com/', 'bx_prod_referral', acf_is_pro() ? 'acf_pro_plugin_footer_text' : 'acf_free_plugin_footer_text', false, 'acf_plugin', 'referral' ); $acf_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/', 'footer', 'footer' ); return sprintf( /* translators: This text is prepended by a link to ACF's website, and appended by a link to WP Engine's website. */ '' . ( acf_is_pro() ? 'ACF PRO' : 'ACF' ) . ' ' . __( 'is developed and maintained by', 'acf' ) . ' WP Engine.', $acf_link, $wp_engine_link ); } /** * Modifies the admin footer version text. * * @since 6.2 * * @param string $text The current admin footer version text. * @return string */ public function admin_footer_version_text( $text ) { $documentation_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/', 'footer', 'footer' ); $support_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/support/', 'footer', 'footer' ); $feedback_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/feedback/', 'footer', 'footer' ); $version_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/changelog/', 'footer', 'footer' ); return sprintf( '%s%s%s%s %s', $documentation_link, __( 'Documentation', 'acf' ), $support_link, __( 'Support', 'acf' ), $feedback_link, __( 'Feedback', 'acf' ), $version_link, acf_is_pro() ? __( 'ACF PRO', 'acf' ) : __( 'ACF', 'acf' ), ACF_VERSION ); } /** * Ensure the ACF parent menu is selected for add-new.php * * @since 6.1 * @param string $parent_file The parent file checked against menu activation. * @return string The modified parent file */ public function ensure_menu_selection( $parent_file ) { if ( ! is_string( $parent_file ) ) { return $parent_file; } if ( strpos( $parent_file, 'edit.php?post_type=acf-' ) === 0 ) { return 'edit.php?post_type=acf-field-group'; } return $parent_file; } /** * Ensure the correct ACF submenu item is selected when in post-new versions of edit pages * * @since 6.1 * @param string $submenu_file The submenu filename. * @return string The modified submenu filename */ public function ensure_submenu_selection( $submenu_file ) { if ( ! is_string( $submenu_file ) ) { return $submenu_file; } if ( strpos( $submenu_file, 'post-new.php?post_type=acf-' ) === 0 ) { return str_replace( 'post-new', 'edit', $submenu_file ); } return $submenu_file; } } // Instantiate. acf_new_instance( 'ACF_Admin' ); endif; // class_exists check