wp/wp-includes/class-wp-customize-panel.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    67 	 * @var string
    67 	 * @var string
    68 	 */
    68 	 */
    69 	public $capability = 'edit_theme_options';
    69 	public $capability = 'edit_theme_options';
    70 
    70 
    71 	/**
    71 	/**
    72 	 * Theme feature support for the panel.
    72 	 * Theme features required to support the panel.
    73 	 *
    73 	 *
    74 	 * @since 4.0.0
    74 	 * @since 4.0.0
    75 	 * @var string|array
    75 	 * @var string|string[]
    76 	 */
    76 	 */
    77 	public $theme_supports = '';
    77 	public $theme_supports = '';
    78 
    78 
    79 	/**
    79 	/**
    80 	 * Title of the panel to show in UI.
    80 	 * Title of the panel to show in UI.
   136 	 * Any supplied $args override class property defaults.
   136 	 * Any supplied $args override class property defaults.
   137 	 *
   137 	 *
   138 	 * @since 4.0.0
   138 	 * @since 4.0.0
   139 	 *
   139 	 *
   140 	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
   140 	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
   141 	 * @param string               $id      An specific ID for the panel.
   141 	 * @param string               $id      A specific ID for the panel.
   142 	 * @param array                $args    Panel arguments.
   142 	 * @param array                $args    {
       
   143 	 *     Optional. Array of properties for the new Panel object. Default empty array.
       
   144 	 *
       
   145 	 *     @type int             $priority        Priority of the panel, defining the display order
       
   146 	 *                                            of panels and sections. Default 160.
       
   147 	 *     @type string          $capability      Capability required for the panel.
       
   148 	 *                                            Default `edit_theme_options`.
       
   149 	 *     @type string|string[] $theme_supports  Theme features required to support the panel.
       
   150 	 *     @type string          $title           Title of the panel to show in UI.
       
   151 	 *     @type string          $description     Description to show in the UI.
       
   152 	 *     @type string          $type            Type of the panel.
       
   153 	 *     @type callable        $active_callback Active callback.
       
   154 	 * }
   143 	 */
   155 	 */
   144 	public function __construct( $manager, $id, $args = array() ) {
   156 	public function __construct( $manager, $id, $args = array() ) {
   145 		$keys = array_keys( get_object_vars( $this ) );
   157 		$keys = array_keys( get_object_vars( $this ) );
   146 		foreach ( $keys as $key ) {
   158 		foreach ( $keys as $key ) {
   147 			if ( isset( $args[ $key ] ) ) {
   159 			if ( isset( $args[ $key ] ) ) {
   222 	 * @since 4.0.0
   234 	 * @since 4.0.0
   223 	 *
   235 	 *
   224 	 * @return bool False if theme doesn't support the panel or the user doesn't have the capability.
   236 	 * @return bool False if theme doesn't support the panel or the user doesn't have the capability.
   225 	 */
   237 	 */
   226 	final public function check_capabilities() {
   238 	final public function check_capabilities() {
   227 		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
   239 		if ( $this->capability && ! current_user_can( $this->capability ) ) {
   228 			return false;
   240 			return false;
   229 		}
   241 		}
   230 
   242 
   231 		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
   243 		if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) {
   232 			return false;
   244 			return false;
   233 		}
   245 		}
   234 
   246 
   235 		return true;
   247 		return true;
   236 	}
   248 	}
   356 		<li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
   368 		<li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
   357 			<button class="customize-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></button>
   369 			<button class="customize-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></button>
   358 			<div class="accordion-section-title">
   370 			<div class="accordion-section-title">
   359 				<span class="preview-notice">
   371 				<span class="preview-notice">
   360 				<?php
   372 				<?php
   361 					/* translators: %s: the site/panel title in the Customizer */
   373 					/* translators: %s: The site/panel title in the Customizer. */
   362 					echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
   374 					printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
   363 				?>
   375 				?>
   364 				</span>
   376 				</span>
   365 				<# if ( data.description ) { #>
   377 				<# if ( data.description ) { #>
   366 					<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
   378 					<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
   367 				<# } #>
   379 				<# } #>
   377 		<?php
   389 		<?php
   378 	}
   390 	}
   379 }
   391 }
   380 
   392 
   381 /** WP_Customize_Nav_Menus_Panel class */
   393 /** WP_Customize_Nav_Menus_Panel class */
   382 require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
   394 require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php';