-
- statuses = array( '' => __('No Image') );
-
- parent::__construct( $manager, $id, $args );
-
- $this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) );
- $this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) );
-
- // Early priority to occur before $this->manager->prepare_controls();
- add_action( 'customize_controls_init', array( $this, 'prepare_control' ), 5 );
- }
/**
- * Prepares the control.
- *
- * If no tabs exist, removes the control from the manager.
+ * Render the control's JS template.
*
- * @since 3.4.2
- */
- public function prepare_control() {
- if ( ! $this->tabs )
- $this->manager->remove_control( $this->id );
- }
-
- /**
- * Refresh the parameters passed to the JavaScript via JSON.
+ * This function is only run for control types that have been registered with
+ * {@see WP_Customize_Manager::register_control_type()}.
*
- * @since 3.4.0
- * @uses WP_Customize_Upload_Control::to_json()
- */
- public function to_json() {
- parent::to_json();
- $this->json['statuses'] = $this->statuses;
- }
-
- /**
- * Render the control's content.
+ * In the future, this will also print the template for the control's container
+ * element and be override-able.
*
- * @since 3.4.0
+ * @since 4.1.0
*/
- public function render_content() {
- $src = $this->value();
- if ( isset( $this->get_url ) )
- $src = call_user_func( $this->get_url, $src );
-
+ final public function print_template() {
?>
-
+
tabs[ $id ] = array(
- 'label' => $label,
- 'callback' => $callback,
- );
- }
-
- /**
- * Remove a tab from the control.
+ * Class variables for this control class are available in the `data` JS object;
+ * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
- * @since 3.4.0
+ * @see WP_Customize_Control::print_template()
*
- * @param string $id
+ * @since 4.1.0
*/
- public function remove_tab( $id ) {
- unset( $this->tabs[ $id ] );
- }
+ protected function content_template() {}
- /**
- * @since 3.4.0
- */
- public function tab_upload_new() {
- if ( ! _device_can_upload() ) {
- echo '
' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.'), 'http://apps.wordpress.org/' ) . '
- Add new image, your theme recommends a header size of %s × %s pixels.' ), $width, $height );
- } elseif ( $width ) {
- printf( __( 'While you can crop images to your liking after clicking Add new image, your theme recommends a header width of %s pixels.' ), $width );
- } else {
- printf( __( 'While you can crop images to your liking after clicking Add new image, your theme recommends a header height of %s pixels.' ), $height );
- }
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- json[ $key ] = $this->$key;
- }
- }
+/** WP_Customize_Site_Icon_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
- public function render_content() {
- ?>
-
-
-
-
-
-
-
-
- manager->widgets->is_sidebar_rendered( $this->sidebar_id );
- }
-}
+/** WP_Customize_Theme_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
-/**
- * Widget Form Customize Control Class
- */
-class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
- public $type = 'widget_form';
- public $widget_id;
- public $widget_id_base;
- public $sidebar_id;
- public $is_new = false;
- public $width;
- public $height;
- public $is_wide = false;
+/** WP_Widget_Area_Customize_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
- public function to_json() {
- parent::to_json();
- $exported_properties = array( 'widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide' );
- foreach ( $exported_properties as $key ) {
- $this->json[ $key ] = $this->$key;
- }
- }
+/** WP_Widget_Form_Customize_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' );
- public function render_content() {
- global $wp_registered_widgets;
- require_once ABSPATH . '/wp-admin/includes/widgets.php';
+/** WP_Customize_Nav_Menu_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' );
- $widget = $wp_registered_widgets[ $this->widget_id ];
- if ( ! isset( $widget['params'][0] ) ) {
- $widget['params'][0] = array();
- }
+/** WP_Customize_Nav_Menu_Item_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' );
- $args = array(
- 'widget_id' => $widget['id'],
- 'widget_name' => $widget['name'],
- );
+/** WP_Customize_Nav_Menu_Location_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' );
- $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
- echo $this->manager->widgets->get_widget_control( $args );
- }
+/** WP_Customize_Nav_Menu_Name_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
- /**
- * Whether the current widget is rendered on the page.
- *
- * @since 4.0.0
- * @access public
- *
- * @return bool Whether the widget is rendered.
- */
- function active_callback() {
- return $this->manager->widgets->is_widget_rendered( $this->widget_id );
- }
-}
+/** WP_Customize_Nav_Menu_Auto_Add_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
+/** WP_Customize_New_Menu_Control class */
+require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' );