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


Generated : Fri Feb 21 08:20:01 2025 Cross-referenced by PHPXref