post-types
2 months ago
tools
3 months ago
views
2 months ago
admin-internal-post-type-list.php
3 months ago
admin-internal-post-type.php
3 months ago
admin-notices.php
3 months ago
admin-options-pages-preview.php
3 months ago
admin-tools.php
3 months ago
admin-upgrade.php
3 months ago
admin.php
3 months ago
index.php
1 year ago
admin-options-pages-preview.php
78 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package ACF |
| 4 | * @author WP Engine |
| 5 | * |
| 6 | * © 2026 Advanced Custom Fields (ACF®). All rights reserved. |
| 7 | * "ACF" is a trademark of WP Engine. |
| 8 | * Licensed under the GNU General Public License v2 or later. |
| 9 | * https://www.gnu.org/licenses/gpl-2.0.html |
| 10 | */ |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | if ( ! class_exists( 'ACF_Admin_Options_Preview' ) ) : |
| 17 | class ACF_Admin_Options_Preview { |
| 18 | |
| 19 | /** |
| 20 | * Constructor. |
| 21 | * |
| 22 | * @since 6.2.2 |
| 23 | */ |
| 24 | public function __construct() { |
| 25 | add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Adds the Options Pages menu item to the admin menu. |
| 30 | * |
| 31 | * @since 6.2.2 |
| 32 | */ |
| 33 | public function admin_menu() { |
| 34 | if ( ! acf_get_setting( 'show_admin' ) ) { |
| 35 | return; |
| 36 | } |
| 37 | $page = add_submenu_page( 'edit.php?post_type=acf-field-group', __( 'Options Pages', 'acf' ), __( 'Options Pages', 'acf' ), acf_get_setting( 'capability' ), 'acf_options_preview', array( $this, 'render' ) ); |
| 38 | add_action( 'load-' . $page, array( $this, 'load' ) ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Load the body class and scripts. |
| 43 | * |
| 44 | * @since 6.2.2 |
| 45 | */ |
| 46 | public function load() { |
| 47 | add_action( 'admin_body_class', array( $this, 'admin_body_class' ) ); |
| 48 | acf_enqueue_scripts(); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Modifies the admin body class. |
| 53 | * |
| 54 | * @since 6.2.2 |
| 55 | * |
| 56 | * @param string $classes Space-separated list of CSS classes. |
| 57 | * @return string |
| 58 | */ |
| 59 | public function admin_body_class( $classes ) { |
| 60 | $classes .= ' acf-admin-page acf-internal-post-type acf-options-preview acf-no-options-pages'; |
| 61 | return $classes; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * The render for the options page preview view. |
| 66 | * |
| 67 | * @since 6.2.2 |
| 68 | */ |
| 69 | public function render() { |
| 70 | $screen = get_current_screen(); |
| 71 | $view = array( 'screen_id' => $screen->id ); |
| 72 | acf_get_view( 'options-page-preview', $view ); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | new ACF_Admin_Options_Preview(); |
| 77 | endif; |
| 78 |