WordPress.org

Make WordPress Core

Changeset 32855


Ignore:
Timestamp:
06/19/2015 08:36:37 AM (4 years ago)
Author:
obenland
Message:

Keep WP_Customize_Nav_Menus_Panel with other panels rather than controls.

Accidentally merged into the wrong file in [32806].
H/t celloexpressions for noticing.

See https://wordpress.slack.com/archives/core-customize/p1434696254000258.
See #32576.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-control.php

    r32848 r32855  
    14051405
    14061406/**
    1407  * Customize Nav Menus Panel Class
    1408  *
    1409  * Needed to add screen options.
    1410  *
    1411  * @since 4.3.0
    1412  */
    1413 class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
    1414 
    1415     /**
    1416      * Control type.
    1417      *
    1418      * @since 4.3.0
    1419      *
    1420      * @access public
    1421      * @var string
    1422      */
    1423     public $type = 'nav_menus';
    1424 
    1425     /**
    1426      * Render screen options for Menus.
    1427      *
    1428      * @since 4.3.0
    1429      */
    1430     public function render_screen_options() {
    1431         // Essentially adds the screen options.
    1432         add_filter( 'manage_nav-menus_columns', array( $this, 'wp_nav_menu_manage_columns' ) );
    1433 
    1434         // Display screen options.
    1435         $screen = WP_Screen::get( 'nav-menus.php' );
    1436         $screen->render_screen_options();
    1437     }
    1438 
    1439     /**
    1440      * Returns the advanced options for the nav menus page.
    1441      *
    1442      * Link title attribute added as it's a relatively advanced concept for new users.
    1443      *
    1444      * @since 4.3.0
    1445      *
    1446      * @return array The advanced menu properties.
    1447      */
    1448     function wp_nav_menu_manage_columns() {
    1449         return array(
    1450             '_title'      => __( 'Show advanced menu properties' ),
    1451             'cb'          => '<input type="checkbox" />',
    1452             'link-target' => __( 'Link Target' ),
    1453             'attr-title'  => __( 'Title Attribute' ),
    1454             'css-classes' => __( 'CSS Classes' ),
    1455             'xfn'         => __( 'Link Relationship (XFN)' ),
    1456             'description' => __( 'Description' ),
    1457         );
    1458     }
    1459 
    1460     /**
    1461      * An Underscore (JS) template for this panel's content (but not its container).
    1462      *
    1463      * Class variables for this panel class are available in the `data` JS object;
    1464      * export custom variables by overriding {@see WP_Customize_Panel::json()}.
    1465      *
    1466      * @since 4.3.0
    1467      *
    1468      * @see WP_Customize_Panel::print_template()
    1469      *
    1470      * @since 4.3.0
    1471      */
    1472     protected function content_template() {
    1473         ?>
    1474         <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
    1475             <button type="button" class="customize-panel-back" tabindex="-1">
    1476                 <span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
    1477             </button>
    1478             <div class="accordion-section-title">
    1479                 <span class="preview-notice">
    1480                     <?php
    1481                         /* translators: %s is the site/panel title in the Customizer */
    1482                         printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
    1483                     ?>
    1484                 </span>
    1485                 <button type="button" class="customize-screen-options-toggle" aria-expanded="false">
    1486                     <span class="screen-reader-text"><?php _e( 'Menu Options' ); ?></span>
    1487                 </button>
    1488                 <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false">
    1489                     <span class="screen-reader-text"><?php _e( 'Help' ); ?></span>
    1490                 </button>
    1491             </div>
    1492             <# if ( data.description ) { #>
    1493             <div class="description customize-panel-description">{{{ data.description }}}</div>
    1494             <# } #>
    1495             <?php $this->render_screen_options(); ?>
    1496         </li>
    1497         <?php
    1498     }
    1499 }
    1500 
    1501 /**
    15021407 * Customize Nav Menu Control Class
    15031408 *
  • trunk/src/wp-includes/class-wp-customize-panel.php

    r32822 r32855  
    381381    }
    382382}
     383
     384/**
     385 * Customize Nav Menus Panel Class
     386 *
     387 * Needed to add screen options.
     388 *
     389 * @since 4.3.0
     390 */
     391class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
     392
     393    /**
     394     * Control type.
     395     *
     396     * @since 4.3.0
     397     *
     398     * @access public
     399     * @var string
     400     */
     401    public $type = 'nav_menus';
     402
     403    /**
     404     * Render screen options for Menus.
     405     *
     406     * @since 4.3.0
     407     */
     408    public function render_screen_options() {
     409        // Essentially adds the screen options.
     410        add_filter( 'manage_nav-menus_columns', array( $this, 'wp_nav_menu_manage_columns' ) );
     411
     412        // Display screen options.
     413        $screen = WP_Screen::get( 'nav-menus.php' );
     414        $screen->render_screen_options();
     415    }
     416
     417    /**
     418     * Returns the advanced options for the nav menus page.
     419     *
     420     * Link title attribute added as it's a relatively advanced concept for new users.
     421     *
     422     * @since 4.3.0
     423     *
     424     * @return array The advanced menu properties.
     425     */
     426    function wp_nav_menu_manage_columns() {
     427        return array(
     428            '_title'      => __( 'Show advanced menu properties' ),
     429            'cb'          => '<input type="checkbox" />',
     430            'link-target' => __( 'Link Target' ),
     431            'attr-title'  => __( 'Title Attribute' ),
     432            'css-classes' => __( 'CSS Classes' ),
     433            'xfn'         => __( 'Link Relationship (XFN)' ),
     434            'description' => __( 'Description' ),
     435        );
     436    }
     437
     438    /**
     439     * An Underscore (JS) template for this panel's content (but not its container).
     440     *
     441     * Class variables for this panel class are available in the `data` JS object;
     442     * export custom variables by overriding {@see WP_Customize_Panel::json()}.
     443     *
     444     * @since 4.3.0
     445     *
     446     * @see WP_Customize_Panel::print_template()
     447     *
     448     * @since 4.3.0
     449     */
     450    protected function content_template() {
     451        ?>
     452        <li class="panel-meta customize-info accordion-section <# if ( ! data.description ) { #> cannot-expand<# } #>">
     453            <button type="button" class="customize-panel-back" tabindex="-1">
     454                <span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
     455            </button>
     456            <div class="accordion-section-title">
     457                <span class="preview-notice">
     458                    <?php
     459                    /* Translators: %s is the site/panel title in the Customizer. */
     460                    printf( __( 'You are customizing %s' ), '<strong class="panel-title">{{ data.title }}</strong>' );
     461                    ?>
     462                </span>
     463                <button type="button" class="customize-screen-options-toggle" aria-expanded="false">
     464                    <span class="screen-reader-text"><?php _e( 'Menu Options' ); ?></span>
     465                </button>
     466                <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false">
     467                    <span class="screen-reader-text"><?php _e( 'Help' ); ?></span>
     468                </button>
     469            </div>
     470            <# if ( data.description ) { #>
     471            <div class="description customize-panel-description">{{{ data.description }}}</div>
     472            <# } #>
     473            <?php $this->render_screen_options(); ?>
     474        </li>
     475    <?php
     476    }
     477}
Note: See TracChangeset for help on using the changeset viewer.