Make WordPress Core


Ignore:
Timestamp:
07/09/2014 11:57:29 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Customizer: Introduce WP_Customize_Control::active() method to determine whether the control is relevant to the current context (i.e. to the current URL being previewed).

Control can indicate its active state by a subclass overriding the 'active_callback' method, by supplying a callable 'active_callback' argument into the control's constructor, or by filtering 'customize_control_active'.

props westonruter.
see #27993.

File:
1 edited

Legend:

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

    r29028 r29051  
    10691069     */
    10701070    public function tally_rendered_widgets( $widget ) {
    1071         $this->rendered_widgets[$widget['id']] = true;
     1071        $this->rendered_widgets[ $widget['id'] ] = true;
     1072    }
     1073
     1074    /**
     1075     * Determine if a widget is rendered on the page.
     1076     *
     1077     * @since 4.0.0
     1078     * @access public
     1079     *
     1080     * @param string $widget_id
     1081     * @return bool
     1082     */
     1083    public function is_widget_rendered( $widget_id ) {
     1084        return in_array( $widget_id, $this->rendered_widgets );
     1085    }
     1086
     1087    /**
     1088     * Determine if a sidebar is rendered on the page.
     1089     *
     1090     * @since 4.0.0
     1091     * @access public
     1092     *
     1093     * @param string $sidebar_id
     1094     * @return bool
     1095     */
     1096    public function is_sidebar_rendered( $sidebar_id ) {
     1097        return in_array( $sidebar_id, $this->rendered_sidebars );
    10721098    }
    10731099
Note: See TracChangeset for help on using the changeset viewer.