[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-customize-control.php (source)

   1  <?php
   2  /**
   3   * WordPress Customize Control classes
   4   *
   5   * @package WordPress
   6   * @subpackage Customize
   7   * @since 3.4.0
   8   */
   9  
  10  /**
  11   * Customize Control class.
  12   *
  13   * @since 3.4.0
  14   */
  15  #[AllowDynamicProperties]
  16  class WP_Customize_Control {
  17  
  18      /**
  19       * Incremented with each new class instantiation, then stored in $instance_number.
  20       *
  21       * Used when sorting two instances whose priorities are equal.
  22       *
  23       * @since 4.1.0
  24       * @var int
  25       */
  26      protected static $instance_count = 0;
  27  
  28      /**
  29       * Order in which this instance was created in relation to other instances.
  30       *
  31       * @since 4.1.0
  32       * @var int
  33       */
  34      public $instance_number;
  35  
  36      /**
  37       * Customizer manager.
  38       *
  39       * @since 3.4.0
  40       * @var WP_Customize_Manager
  41       */
  42      public $manager;
  43  
  44      /**
  45       * Control ID.
  46       *
  47       * @since 3.4.0
  48       * @var string
  49       */
  50      public $id;
  51  
  52      /**
  53       * All settings tied to the control.
  54       *
  55       * @since 3.4.0
  56       * @var array
  57       */
  58      public $settings;
  59  
  60      /**
  61       * The primary setting for the control (if there is one).
  62       *
  63       * @since 3.4.0
  64       * @var string|WP_Customize_Setting|null
  65       */
  66      public $setting = 'default';
  67  
  68      /**
  69       * Capability required to use this control.
  70       *
  71       * Normally this is empty and the capability is derived from the capabilities
  72       * of the associated `$settings`.
  73       *
  74       * @since 4.5.0
  75       * @var string
  76       */
  77      public $capability;
  78  
  79      /**
  80       * Order priority to load the control in Customizer.
  81       *
  82       * @since 3.4.0
  83       * @var int
  84       */
  85      public $priority = 10;
  86  
  87      /**
  88       * Section the control belongs to.
  89       *
  90       * @since 3.4.0
  91       * @var string
  92       */
  93      public $section = '';
  94  
  95      /**
  96       * Label for the control.
  97       *
  98       * @since 3.4.0
  99       * @var string
 100       */
 101      public $label = '';
 102  
 103      /**
 104       * Description for the control.
 105       *
 106       * @since 4.0.0
 107       * @var string
 108       */
 109      public $description = '';
 110  
 111      /**
 112       * List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values.
 113       *
 114       * @since 3.4.0
 115       * @var array
 116       */
 117      public $choices = array();
 118  
 119      /**
 120       * List of custom input attributes for control output, where attribute names are the keys and values are the values.
 121       *
 122       * Not used for 'checkbox', 'radio', 'select', 'textarea', or 'dropdown-pages' control types.
 123       *
 124       * @since 4.0.0
 125       * @var array
 126       */
 127      public $input_attrs = array();
 128  
 129      /**
 130       * Show UI for adding new content, currently only used for the dropdown-pages control.
 131       *
 132       * @since 4.7.0
 133       * @var bool
 134       */
 135      public $allow_addition = false;
 136  
 137      /**
 138       * @deprecated It is better to just call the json() method
 139       * @since 3.4.0
 140       * @var array
 141       */
 142      public $json = array();
 143  
 144      /**
 145       * Control's Type.
 146       *
 147       * @since 3.4.0
 148       * @var string
 149       */
 150      public $type = 'text';
 151  
 152      /**
 153       * Callback.
 154       *
 155       * @since 4.0.0
 156       *
 157       * @see WP_Customize_Control::active()
 158       *
 159       * @var callable Callback is called with one argument, the instance of
 160       *               WP_Customize_Control, and returns bool to indicate whether
 161       *               the control is active (such as it relates to the URL
 162       *               currently being previewed).
 163       */
 164      public $active_callback = '';
 165  
 166      /**
 167       * Constructor.
 168       *
 169       * Supplied `$args` override class property defaults.
 170       *
 171       * If `$args['settings']` is not defined, use the `$id` as the setting ID.
 172       *
 173       * @since 3.4.0
 174       *
 175       * @param WP_Customize_Manager $manager Customizer bootstrap instance.
 176       * @param string               $id      Control ID.
 177       * @param array                $args    {
 178       *     Optional. Array of properties for the new Control object. Default empty array.
 179       *
 180       *     @type int                  $instance_number Order in which this instance was created in relation
 181       *                                                 to other instances.
 182       *     @type WP_Customize_Manager $manager         Customizer bootstrap instance.
 183       *     @type string               $id              Control ID.
 184       *     @type array                $settings        All settings tied to the control. If undefined, `$id` will
 185       *                                                 be used.
 186       *     @type string               $setting         The primary setting for the control (if there is one).
 187       *                                                 Default 'default'.
 188       *     @type string               $capability      Capability required to use this control. Normally this is empty
 189       *                                                 and the capability is derived from `$settings`.
 190       *     @type int                  $priority        Order priority to load the control. Default 10.
 191       *     @type string               $section         Section the control belongs to. Default empty.
 192       *     @type string               $label           Label for the control. Default empty.
 193       *     @type string               $description     Description for the control. Default empty.
 194       *     @type array                $choices         List of choices for 'radio' or 'select' type controls, where
 195       *                                                 values are the keys, and labels are the values.
 196       *                                                 Default empty array.
 197       *     @type array                $input_attrs     List of custom input attributes for control output, where
 198       *                                                 attribute names are the keys and values are the values. Not
 199       *                                                 used for 'checkbox', 'radio', 'select', 'textarea', or
 200       *                                                 'dropdown-pages' control types. Default empty array.
 201       *     @type bool                 $allow_addition  Show UI for adding new content, currently only used for the
 202       *                                                 dropdown-pages control. Default false.
 203       *     @type array                $json            Deprecated. Use WP_Customize_Control::json() instead.
 204       *     @type string               $type            Control type. Core controls include 'text', 'checkbox',
 205       *                                                 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional
 206       *                                                 input types such as 'email', 'url', 'number', 'hidden', and
 207       *                                                 'date' are supported implicitly. Default 'text'.
 208       *     @type callable             $active_callback Active callback.
 209       * }
 210       */
 211  	public function __construct( $manager, $id, $args = array() ) {
 212          $keys = array_keys( get_object_vars( $this ) );
 213          foreach ( $keys as $key ) {
 214              if ( isset( $args[ $key ] ) ) {
 215                  $this->$key = $args[ $key ];
 216              }
 217          }
 218  
 219          $this->manager = $manager;
 220          $this->id      = $id;
 221          if ( empty( $this->active_callback ) ) {
 222              $this->active_callback = array( $this, 'active_callback' );
 223          }
 224          self::$instance_count += 1;
 225          $this->instance_number = self::$instance_count;
 226  
 227          // Process settings.
 228          if ( ! isset( $this->settings ) ) {
 229              $this->settings = $id;
 230          }
 231  
 232          $settings = array();
 233          if ( is_array( $this->settings ) ) {
 234              foreach ( $this->settings as $key => $setting ) {
 235                  $settings[ $key ] = $this->manager->get_setting( $setting );
 236              }
 237          } elseif ( is_string( $this->settings ) ) {
 238              $this->setting       = $this->manager->get_setting( $this->settings );
 239              $settings['default'] = $this->setting;
 240          }
 241          $this->settings = $settings;
 242      }
 243  
 244      /**
 245       * Enqueue control related scripts/styles.
 246       *
 247       * @since 3.4.0
 248       */
 249  	public function enqueue() {}
 250  
 251      /**
 252       * Check whether control is active to current Customizer preview.
 253       *
 254       * @since 4.0.0
 255       *
 256       * @return bool Whether the control is active to the current preview.
 257       */
 258  	final public function active() {
 259          $control = $this;
 260          $active  = call_user_func( $this->active_callback, $this );
 261  
 262          /**
 263           * Filters response of WP_Customize_Control::active().
 264           *
 265           * @since 4.0.0
 266           *
 267           * @param bool                 $active  Whether the Customizer control is active.
 268           * @param WP_Customize_Control $control WP_Customize_Control instance.
 269           */
 270          $active = apply_filters( 'customize_control_active', $active, $control );
 271  
 272          return $active;
 273      }
 274  
 275      /**
 276       * Default callback used when invoking WP_Customize_Control::active().
 277       *
 278       * Subclasses can override this with their specific logic, or they may
 279       * provide an 'active_callback' argument to the constructor.
 280       *
 281       * @since 4.0.0
 282       *
 283       * @return true Always true.
 284       */
 285  	public function active_callback() {
 286          return true;
 287      }
 288  
 289      /**
 290       * Fetch a setting's value.
 291       * Grabs the main setting by default.
 292       *
 293       * @since 3.4.0
 294       *
 295       * @param string $setting_key
 296       * @return mixed The requested setting's value, if the setting exists.
 297       */
 298  	final public function value( $setting_key = 'default' ) {
 299          if ( isset( $this->settings[ $setting_key ] ) ) {
 300              return $this->settings[ $setting_key ]->value();
 301          }
 302      }
 303  
 304      /**
 305       * Refresh the parameters passed to the JavaScript via JSON.
 306       *
 307       * @since 3.4.0
 308       */
 309  	public function to_json() {
 310          $this->json['settings'] = array();
 311          foreach ( $this->settings as $key => $setting ) {
 312              $this->json['settings'][ $key ] = $setting->id;
 313          }
 314  
 315          $this->json['type']           = $this->type;
 316          $this->json['priority']       = $this->priority;
 317          $this->json['active']         = $this->active();
 318          $this->json['section']        = $this->section;
 319          $this->json['content']        = $this->get_content();
 320          $this->json['label']          = $this->label;
 321          $this->json['description']    = $this->description;
 322          $this->json['instanceNumber'] = $this->instance_number;
 323  
 324          if ( 'dropdown-pages' === $this->type ) {
 325              $this->json['allow_addition'] = $this->allow_addition;
 326          }
 327      }
 328  
 329      /**
 330       * Get the data to export to the client via JSON.
 331       *
 332       * @since 4.1.0
 333       *
 334       * @return array Array of parameters passed to the JavaScript.
 335       */
 336  	public function json() {
 337          $this->to_json();
 338          return $this->json;
 339      }
 340  
 341      /**
 342       * Checks if the user can use this control.
 343       *
 344       * Returns false if the user cannot manipulate one of the associated settings,
 345       * or if one of the associated settings does not exist. Also returns false if
 346       * the associated section does not exist or if its capability check returns
 347       * false.
 348       *
 349       * @since 3.4.0
 350       *
 351       * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true.
 352       */
 353  	final public function check_capabilities() {
 354          if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) {
 355              return false;
 356          }
 357  
 358          foreach ( $this->settings as $setting ) {
 359              if ( ! $setting || ! $setting->check_capabilities() ) {
 360                  return false;
 361              }
 362          }
 363  
 364          $section = $this->manager->get_section( $this->section );
 365          if ( isset( $section ) && ! $section->check_capabilities() ) {
 366              return false;
 367          }
 368  
 369          return true;
 370      }
 371  
 372      /**
 373       * Get the control's content for insertion into the Customizer pane.
 374       *
 375       * @since 4.1.0
 376       *
 377       * @return string Contents of the control.
 378       */
 379  	final public function get_content() {
 380          ob_start();
 381          $this->maybe_render();
 382          return trim( ob_get_clean() );
 383      }
 384  
 385      /**
 386       * Check capabilities and render the control.
 387       *
 388       * @since 3.4.0
 389       * @uses WP_Customize_Control::render()
 390       */
 391  	final public function maybe_render() {
 392          if ( ! $this->check_capabilities() ) {
 393              return;
 394          }
 395  
 396          /**
 397           * Fires just before the current Customizer control is rendered.
 398           *
 399           * @since 3.4.0
 400           *
 401           * @param WP_Customize_Control $control WP_Customize_Control instance.
 402           */
 403          do_action( 'customize_render_control', $this );
 404  
 405          /**
 406           * Fires just before a specific Customizer control is rendered.
 407           *
 408           * The dynamic portion of the hook name, `$this->id`, refers to
 409           * the control ID.
 410           *
 411           * @since 3.4.0
 412           *
 413           * @param WP_Customize_Control $control WP_Customize_Control instance.
 414           */
 415          do_action( "customize_render_control_{$this->id}", $this );
 416  
 417          $this->render();
 418      }
 419  
 420      /**
 421       * Renders the control wrapper and calls $this->render_content() for the internals.
 422       *
 423       * @since 3.4.0
 424       */
 425  	protected function render() {
 426          $id    = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
 427          $class = 'customize-control customize-control-' . $this->type;
 428  
 429          printf( '<li id="%s" class="%s">', esc_attr( $id ), esc_attr( $class ) );
 430          $this->render_content();
 431          echo '</li>';
 432      }
 433  
 434      /**
 435       * Get the data link attribute for a setting.
 436       *
 437       * @since 3.4.0
 438       * @since 4.9.0 Return a `data-customize-setting-key-link` attribute if a setting is not registered for the supplied setting key.
 439       *
 440       * @param string $setting_key
 441       * @return string Data link parameter, a `data-customize-setting-link` attribute if the `$setting_key` refers to a pre-registered setting,
 442       *                and a `data-customize-setting-key-link` attribute if the setting is not yet registered.
 443       */
 444  	public function get_link( $setting_key = 'default' ) {
 445          if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof WP_Customize_Setting ) {
 446              return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
 447          } else {
 448              return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"';
 449          }
 450      }
 451  
 452      /**
 453       * Render the data link attribute for the control's input element.
 454       *
 455       * @since 3.4.0
 456       * @uses WP_Customize_Control::get_link()
 457       *
 458       * @param string $setting_key
 459       */
 460  	public function link( $setting_key = 'default' ) {
 461          echo $this->get_link( $setting_key );
 462      }
 463  
 464      /**
 465       * Render the custom attributes for the control's input element.
 466       *
 467       * @since 4.0.0
 468       */
 469  	public function input_attrs() {
 470          foreach ( $this->input_attrs as $attr => $value ) {
 471              echo $attr . '="' . esc_attr( $value ) . '" ';
 472          }
 473      }
 474  
 475      /**
 476       * Render the control's content.
 477       *
 478       * Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`.
 479       *
 480       * Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`.
 481       * Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly.
 482       *
 483       * Control content can alternately be rendered in JS. See WP_Customize_Control::print_template().
 484       *
 485       * @since 3.4.0
 486       */
 487  	protected function render_content() {
 488          $input_id         = '_customize-input-' . $this->id;
 489          $description_id   = '_customize-description-' . $this->id;
 490          $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : '';
 491          switch ( $this->type ) {
 492              case 'checkbox':
 493                  ?>
 494                  <span class="customize-inside-control-row">
 495                      <input
 496                          id="<?php echo esc_attr( $input_id ); ?>"
 497                          <?php echo $describedby_attr; ?>
 498                          type="checkbox"
 499                          value="<?php echo esc_attr( $this->value() ); ?>"
 500                          <?php $this->link(); ?>
 501                          <?php checked( $this->value() ); ?>
 502                      />
 503                      <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $this->label ); ?></label>
 504                      <?php if ( ! empty( $this->description ) ) : ?>
 505                          <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 506                      <?php endif; ?>
 507                  </span>
 508                  <?php
 509                  break;
 510              case 'radio':
 511                  if ( empty( $this->choices ) ) {
 512                      return;
 513                  }
 514  
 515                  $name = '_customize-radio-' . $this->id;
 516                  ?>
 517                  <?php if ( ! empty( $this->label ) ) : ?>
 518                      <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
 519                  <?php endif; ?>
 520                  <?php if ( ! empty( $this->description ) ) : ?>
 521                      <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 522                  <?php endif; ?>
 523  
 524                  <?php foreach ( $this->choices as $value => $label ) : ?>
 525                      <span class="customize-inside-control-row">
 526                          <input
 527                              id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"
 528                              type="radio"
 529                              <?php echo $describedby_attr; ?>
 530                              value="<?php echo esc_attr( $value ); ?>"
 531                              name="<?php echo esc_attr( $name ); ?>"
 532                              <?php $this->link(); ?>
 533                              <?php checked( $this->value(), $value ); ?>
 534                              />
 535                          <label for="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"><?php echo esc_html( $label ); ?></label>
 536                      </span>
 537                  <?php endforeach; ?>
 538                  <?php
 539                  break;
 540              case 'select':
 541                  if ( empty( $this->choices ) ) {
 542                      return;
 543                  }
 544  
 545                  ?>
 546                  <?php if ( ! empty( $this->label ) ) : ?>
 547                      <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
 548                  <?php endif; ?>
 549                  <?php if ( ! empty( $this->description ) ) : ?>
 550                      <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 551                  <?php endif; ?>
 552  
 553                  <select id="<?php echo esc_attr( $input_id ); ?>" <?php echo $describedby_attr; ?> <?php $this->link(); ?>>
 554                      <?php
 555                      foreach ( $this->choices as $value => $label ) {
 556                          echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label ) . '</option>';
 557                      }
 558                      ?>
 559                  </select>
 560                  <?php
 561                  break;
 562              case 'textarea':
 563                  ?>
 564                  <?php if ( ! empty( $this->label ) ) : ?>
 565                      <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
 566                  <?php endif; ?>
 567                  <?php if ( ! empty( $this->description ) ) : ?>
 568                      <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 569                  <?php endif; ?>
 570                  <textarea
 571                      id="<?php echo esc_attr( $input_id ); ?>"
 572                      rows="5"
 573                      <?php echo $describedby_attr; ?>
 574                      <?php $this->input_attrs(); ?>
 575                      <?php $this->link(); ?>
 576                  ><?php echo esc_textarea( $this->value() ); ?></textarea>
 577                  <?php
 578                  break;
 579              case 'dropdown-pages':
 580                  ?>
 581                  <?php if ( ! empty( $this->label ) ) : ?>
 582                      <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
 583                  <?php endif; ?>
 584                  <?php if ( ! empty( $this->description ) ) : ?>
 585                      <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 586                  <?php endif; ?>
 587  
 588                  <?php
 589                  $dropdown_name     = '_customize-dropdown-pages-' . $this->id;
 590                  $show_option_none  = __( '&mdash; Select &mdash;' );
 591                  $option_none_value = '0';
 592                  $dropdown          = wp_dropdown_pages(
 593                      array(
 594                          'name'              => $dropdown_name,
 595                          'echo'              => 0,
 596                          'show_option_none'  => $show_option_none,
 597                          'option_none_value' => $option_none_value,
 598                          'selected'          => $this->value(),
 599                      )
 600                  );
 601                  if ( empty( $dropdown ) ) {
 602                      $dropdown  = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) );
 603                      $dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) );
 604                      $dropdown .= '</select>';
 605                  }
 606  
 607                  // Hackily add in the data link parameter.
 608                  $dropdown = str_replace( '<select', '<select ' . $this->get_link() . ' id="' . esc_attr( $input_id ) . '" ' . $describedby_attr, $dropdown );
 609  
 610                  /*
 611                   * Even more hackily add auto-draft page stubs.
 612                   * @todo Eventually this should be removed in favor of the pages being injected into the underlying get_pages() call.
 613                   * See <https://github.com/xwp/wp-customize-posts/pull/250>.
 614                   */
 615                  $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' );
 616                  if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) {
 617                      $auto_draft_page_options = '';
 618                      foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) {
 619                          $post = get_post( $auto_draft_page_id );
 620                          if ( $post && 'page' === $post->post_type ) {
 621                              $auto_draft_page_options .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $post->ID ), esc_html( $post->post_title ) );
 622                          }
 623                      }
 624                      if ( $auto_draft_page_options ) {
 625                          $dropdown = str_replace( '</select>', $auto_draft_page_options . '</select>', $dropdown );
 626                      }
 627                  }
 628  
 629                  echo $dropdown;
 630                  ?>
 631                  <?php if ( $this->allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : // Currently tied to menus functionality. ?>
 632                      <button type="button" class="button-link add-new-toggle">
 633                          <?php
 634                          /* translators: %s: Add New Page label. */
 635                          printf( __( '+ %s' ), get_post_type_object( 'page' )->labels->add_new_item );
 636                          ?>
 637                      </button>
 638                      <div class="new-content-item-wrapper">
 639                          <label for="create-input-<?php echo esc_attr( $this->id ); ?>"><?php _e( 'New page title' ); ?></label>
 640                          <div class="new-content-item">
 641                              <input type="text" id="create-input-<?php echo esc_attr( $this->id ); ?>" class="create-item-input" >
 642                              <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button>
 643                          </div>
 644                      </div>
 645                  <?php endif; ?>
 646                  <?php
 647                  break;
 648              default:
 649                  ?>
 650                  <?php if ( ! empty( $this->label ) ) : ?>
 651                      <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
 652                  <?php endif; ?>
 653                  <?php if ( ! empty( $this->description ) ) : ?>
 654                      <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
 655                  <?php endif; ?>
 656                  <input
 657                      id="<?php echo esc_attr( $input_id ); ?>"
 658                      type="<?php echo esc_attr( $this->type ); ?>"
 659                      <?php echo $describedby_attr; ?>
 660                      <?php $this->input_attrs(); ?>
 661                      <?php if ( ! isset( $this->input_attrs['value'] ) ) : ?>
 662                          value="<?php echo esc_attr( $this->value() ); ?>"
 663                      <?php endif; ?>
 664                      <?php $this->link(); ?>
 665                      />
 666                  <?php
 667                  break;
 668          }
 669      }
 670  
 671      /**
 672       * Render the control's JS template.
 673       *
 674       * This function is only run for control types that have been registered with
 675       * WP_Customize_Manager::register_control_type().
 676       *
 677       * In the future, this will also print the template for the control's container
 678       * element and be override-able.
 679       *
 680       * @since 4.1.0
 681       */
 682  	final public function print_template() {
 683          ?>
 684          <script type="text/html" id="tmpl-customize-control-<?php echo esc_attr( $this->type ); ?>-content">
 685              <?php $this->content_template(); ?>
 686          </script>
 687          <?php
 688      }
 689  
 690      /**
 691       * An Underscore (JS) template for this control's content (but not its container).
 692       *
 693       * Class variables for this control class are available in the `data` JS object;
 694       * export custom variables by overriding WP_Customize_Control::to_json().
 695       *
 696       * @see WP_Customize_Control::print_template()
 697       *
 698       * @since 4.1.0
 699       */
 700  	protected function content_template() {}
 701  }
 702  
 703  /**
 704   * WP_Customize_Color_Control class.
 705   */
 706  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php';
 707  
 708  /**
 709   * WP_Customize_Media_Control class.
 710   */
 711  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php';
 712  
 713  /**
 714   * WP_Customize_Upload_Control class.
 715   */
 716  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php';
 717  
 718  /**
 719   * WP_Customize_Image_Control class.
 720   */
 721  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php';
 722  
 723  /**
 724   * WP_Customize_Background_Image_Control class.
 725   */
 726  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php';
 727  
 728  /**
 729   * WP_Customize_Background_Position_Control class.
 730   */
 731  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php';
 732  
 733  /**
 734   * WP_Customize_Cropped_Image_Control class.
 735   */
 736  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php';
 737  
 738  /**
 739   * WP_Customize_Site_Icon_Control class.
 740   */
 741  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php';
 742  
 743  /**
 744   * WP_Customize_Header_Image_Control class.
 745   */
 746  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php';
 747  
 748  /**
 749   * WP_Customize_Theme_Control class.
 750   */
 751  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php';
 752  
 753  /**
 754   * WP_Widget_Area_Customize_Control class.
 755   */
 756  require_once  ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php';
 757  
 758  /**
 759   * WP_Widget_Form_Customize_Control class.
 760   */
 761  require_once  ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php';
 762  
 763  /**
 764   * WP_Customize_Nav_Menu_Control class.
 765   */
 766  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php';
 767  
 768  /**
 769   * WP_Customize_Nav_Menu_Item_Control class.
 770   */
 771  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php';
 772  
 773  /**
 774   * WP_Customize_Nav_Menu_Location_Control class.
 775   */
 776  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php';
 777  
 778  /**
 779   * WP_Customize_Nav_Menu_Name_Control class.
 780   *
 781   * As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent
 782   * release, the require_once here will be removed and _deprecated_file() will be called if file is
 783   * required at all.
 784   *
 785   * @deprecated 4.9.0 This file is no longer used due to new menu creation UX.
 786   */
 787  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php';
 788  
 789  /**
 790   * WP_Customize_Nav_Menu_Locations_Control class.
 791   */
 792  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php';
 793  
 794  /**
 795   * WP_Customize_Nav_Menu_Auto_Add_Control class.
 796   */
 797  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php';
 798  
 799  /**
 800   * WP_Customize_Date_Time_Control class.
 801   */
 802  require_once  ABSPATH . WPINC . '/customize/class-wp-customize-date-time-control.php';
 803  
 804  /**
 805   * WP_Sidebar_Block_Editor_Control class.
 806   */
 807  require_once  ABSPATH . WPINC . '/customize/class-wp-sidebar-block-editor-control.php';


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref