__construct() public method

Any supplied $args override class property defaults.
Since: 3.4.0
public __construct ( WP_Customize_Manager $manager, string $id, array $args = [] )
$manager WP_Customize_Manager
$id string An specific ID of the setting. Can be a theme mod or option name.
$args array Setting arguments.
 /**
  * WP_Customize_Custom_CSS_Setting constructor.
  *
  * @since 4.7.0
  * @access public
  *
  * @throws Exception If the setting ID does not match the pattern `custom_css[$stylesheet]`.
  *
  * @param WP_Customize_Manager $manager The Customize Manager class.
  * @param string               $id      An specific ID of the setting. Can be a
  *                                      theme mod or option name.
  * @param array                $args    Setting arguments.
  */
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if ('custom_css' !== $this->id_data['base']) {
         throw new Exception('Expected custom_css id_base.');
     }
     if (1 !== count($this->id_data['keys']) || empty($this->id_data['keys'][0])) {
         throw new Exception('Expected single stylesheet key.');
     }
     $this->stylesheet = $this->id_data['keys'][0];
 }
 /**
  * WP_Customize_REST_Resource_Setting constructor.
  *
  * @param \WP_Customize_Manager $manager Manager.
  * @param string                $id      Setting ID.
  * @param array                 $args    Setting args.
  * @throws Exception If the ID is in an invalid format.
  */
 public function __construct($manager, $id, $args = array())
 {
     if (!isset($args['sanitize_callback'])) {
         $args['sanitize_callback'] = array($this, 'sanitize');
     }
     if (!preg_match('#^rest_resource\\[(?P<route>.+?)]$#', $id, $matches)) {
         throw new Exception('Illegal setting id: ' . $id);
     }
     $this->route = trim($matches['route'], '/');
     if (!isset($args['plugin']) || !$args['plugin'] instanceof Plugin) {
         throw new Exception(sprintf('Missing plugin arg for %s', get_class($this)));
     }
     parent::__construct($manager, $id, $args);
 }
 /**
  * Constructor.
  *
  * Any supplied $args override class property defaults.
  *
  * @param \WP_Customize_Manager $manager Manager instance.
  * @param string                $id      An specific ID of the setting. Can be a
  *                                       theme mod or option name.
  * @param array                 $args    Setting arguments.
  * @throws Exception If $id is not valid for a widget.
  */
 public function __construct(\WP_Customize_Manager $manager, $id, array $args = array())
 {
     unset($args['type']);
     if (!preg_match(static::WIDGET_SETTING_ID_PATTERN, $id, $matches)) {
         throw new Exception("Illegal widget setting ID: {$id}");
     }
     $this->widget_id_base = $matches['widget_id_base'];
     if (isset($matches['widget_number'])) {
         $this->widget_number = intval($matches['widget_number']);
     }
     parent::__construct($manager, $id, $args);
     if (empty($this->widget_posts)) {
         throw new Exception('Missing argument: widget_posts');
     }
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     // Will onvert the setting from JSON to array. Must be triggered very soon
     add_filter("customize_sanitize_{$this->id}", array($this, 'sanitize_repeater_setting'), 10, 1);
 }
 /**
  * Constructor.
  *
  * Any supplied $args override class property defaults.
  *
  * @since 4.3.0
  * @access public
  *
  * @param WP_Customize_Manager $manager Bootstrap Customizer instance.
  * @param string               $id      An specific ID of the setting. Can be a
  *                                      theme mod or option name.
  * @param array                $args    Optional. Setting arguments.
  *
  * @throws Exception If $id is not valid for this setting type.
  */
 public function __construct(WP_Customize_Manager $manager, $id, array $args = array())
 {
     if (empty($manager->nav_menus)) {
         throw new Exception('Expected WP_Customize_Manager::$nav_menus to be set.');
     }
     if (!preg_match(self::ID_PATTERN, $id, $matches)) {
         throw new Exception("Illegal widget setting ID: {$id}");
     }
     $this->post_id = intval($matches['id']);
     add_action('wp_update_nav_menu_item', array($this, 'flush_cached_value'), 10, 2);
     parent::__construct($manager, $id, $args);
     // Ensure that an initially-supplied value is valid.
     if (isset($this->value)) {
         $this->populate_value();
         foreach (array_diff(array_keys($this->default), array_keys($this->value)) as $missing) {
             throw new Exception("Supplied nav_menu_item value missing property: {$missing}");
         }
     }
 }
 /**
  * Constructor.
  *
  * Any supplied $args override class property defaults.
  *
  * @since 4.3.0
  * @access public
  *
  * @param WP_Customize_Manager $manager Bootstrap Customizer instance.
  * @param string               $id      An specific ID of the setting. Can be a
  *                                      theme mod or option name.
  * @param array                $args    Optional. Setting arguments.
  *
  * @throws Exception If $id is not valid for this setting type.
  */
 public function __construct(WP_Customize_Manager $manager, $id, array $args = array())
 {
     if (empty($manager->nav_menus)) {
         throw new Exception('Expected WP_Customize_Manager::$nav_menus to be set.');
     }
     if (!preg_match(self::ID_PATTERN, $id, $matches)) {
         throw new Exception("Illegal widget setting ID: {$id}");
     }
     $this->term_id = intval($matches['id']);
     parent::__construct($manager, $id, $args);
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     // set up the id_data, etc.
     if (!WeaverX_Customize_Setting::$filter_added) {
         add_filter('pre_option_' . $this->id_data['base'], 'WeaverX_Customize_Setting::_preview_filter_cache');
         add_filter('option_' . $this->id_data['base'], 'WeaverX_Customize_Setting::_preview_filter_cache');
         add_filter('default_option_' . $this->id_data['base'], 'WeaverX_Customize_Setting::_preview_filter_cache');
         WeaverX_Customize_Setting::$filter_added = true;
     }
 }