Inheritance: extends WP_Customize_Control
 public function to_json()
 {
     parent::to_json();
     $this->json['choices'] = array();
     if (is_array($this->choices)) {
         if (isset($this->choices['top']) && true == $this->choices['top']) {
             $this->json['choices']['top'] = true;
         }
         if (isset($this->choices['bottom']) && true == $this->choices['bottom']) {
             $this->json['choices']['bottom'] = true;
         }
         if (isset($this->choices['left']) && true == $this->choices['left']) {
             $this->json['choices']['left'] = true;
         }
         if (isset($this->choices['right']) && true == $this->choices['right']) {
             $this->json['choices']['right'] = true;
         }
     }
     $i18n = Kirki_Toolkit::i18n();
     $this->json['l10n'] = array('top' => $i18n['top'], 'bottom' => $i18n['bottom'], 'left' => $i18n['left'], 'right' => $i18n['right']);
     if (isset($this->json['choices']['top']) && !isset($this->json['value']['top'])) {
         $this->json['value']['top'] = $this->json['default']['top'];
     }
     if (isset($this->json['choices']['bottom']) && !isset($this->json['value']['bottom'])) {
         $this->json['value']['bottom'] = $this->json['default']['bottom'];
     }
     if (isset($this->json['choices']['left']) && !isset($this->json['value']['left'])) {
         $this->json['value']['left'] = $this->json['default']['left'];
     }
     if (isset($this->json['choices']['right']) && !isset($this->json['value']['top'])) {
         $this->json['value']['right'] = $this->json['default']['right'];
     }
 }
 public function to_json()
 {
     parent::to_json();
     $this->json['choices'] = is_array($this->choices) ? array('top' => in_array('top', $this->choices) ? true : false, 'bottom' => in_array('bottom', $this->choices) ? true : false, 'left' => in_array('left', $this->choices) ? true : false, 'right' => in_array('right', $this->choices) ? true : false, 'units' => isset($this->choices['units']) ? $this->choices['units'] : false) : array();
     $i18n = Kirki_Toolkit::i18n();
     $this->json['l10n'] = array('top' => $i18n['top'], 'bottom' => $i18n['bottom'], 'left' => $i18n['left'], 'right' => $i18n['right']);
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['choices']['min'] = isset($this->choices['min']) ? $this->choices['min'] : '0';
     $this->json['choices']['max'] = isset($this->choices['max']) ? $this->choices['max'] : '100';
     $this->json['choices']['step'] = isset($this->choices['step']) ? $this->choices['step'] : '1';
 }
 public function to_json()
 {
     parent::to_json();
     $i18n = Kirki_Toolkit::i18n();
     $this->json['fonts'] = $this->get_all_fonts();
     $value = $this->value();
     $this->json['value'] = array('bold' => isset($value['bold']) ? $value['bold'] : false, 'italic' => isset($value['italic']) ? $value['italic'] : false, 'underline' => isset($value['underline']) ? $value['underline'] : false, 'strikethrough' => isset($value['strikethrough']) ? $value['strikethrough'] : false, 'font-family' => isset($value['font-family']) ? $value['font-family'] : '', 'font-size' => isset($value['font-size']) ? $value['font-size'] : '', 'font-weight' => isset($value['font-weight']) ? $value['font-weight'] : '', 'line-height' => isset($value['line-height']) ? $value['line-height'] : '', 'letter-spacing' => isset($value['letter-spacing']) ? $value['letter-spacing'] : '', 'color' => isset($value['color']) ? $value['color'] : '');
     $this->json['l10n'] = array('font-family' => $i18n['font-family'], 'font-size' => $i18n['font-size'], 'font-weight' => $i18n['font-weight'], 'line-height' => $i18n['line-height'], 'letter-spacing' => $i18n['letter-spacing'], 'color' => $i18n['color']);
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $l10n = Kirki_l10n::get_strings($this->kirki_config);
     $dropdown = wp_dropdown_pages(array('name' => '_customize-dropdown-pages-' . esc_attr($this->id), 'echo' => 0, 'show_option_none' => esc_attr($l10n['select-page']), 'option_none_value' => '0', 'selected' => esc_attr($this->value())));
     // Hackily add in the data link parameter.
     $dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
     $this->json['dropdown'] = $dropdown;
 }
 public function to_json()
 {
     parent::to_json();
     $i18n = Kirki_Toolkit::i18n();
     $this->json['choices'] = empty($this->choices) || !is_array($this->choices) ? array() : $this->choices;
     $this->json['choices']['on'] = isset($this->choices['on']) ? $this->choices['on'] : $i18n['on'];
     $this->json['choices']['off'] = isset($this->choices['off']) ? $this->choices['off'] : $i18n['off'];
     $this->json['choices']['round'] = isset($this->choices['round']) ? $this->choices['round'] : false;
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $this->add_values_backwards_compatibility();
     $defaults = array('font-family' => false, 'font-size' => false, 'variant' => false, 'line-height' => false, 'letter-spacing' => false, 'color' => false, 'text-align' => false);
     $this->json['default'] = wp_parse_args($this->json['default'], $defaults);
     $this->json['show_variants'] = true === Kirki_Fonts_Google::$force_load_all_variants ? false : true;
     $this->json['show_subsets'] = true === Kirki_Fonts_Google::$force_load_all_subsets ? false : true;
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     // If no palette has been defined, use Material Design Palette.
     if (!isset($this->json['choices']['colors']) || empty($this->json['choices']['colors'])) {
         $this->json['choices']['colors'] = Kirki_Helper::get_material_design_colors('primary');
     }
     if (!isset($this->json['choices']['size']) || empty($this->json['choices']['size'])) {
         $this->json['choices']['size'] = 42;
     }
 }
 public function to_json()
 {
     parent::to_json();
     if (!isset($this->choices['language'])) {
         $this->choices['language'] = 'css';
     }
     if (!isset($this->choices['theme'])) {
         $this->choices['theme'] = 'monokai';
     }
     if (!isset($this->choices['height'])) {
         $this->choices['height'] = 200;
     }
 }
 public function to_json()
 {
     parent::to_json();
     $fields = $this->fields;
     $i18n = Kirki_Toolkit::i18n();
     $default_image_button_labels = array('default' => $i18n['add-image'], 'remove' => $i18n['remove'], 'change' => $i18n['change-image'], 'placeholder' => $i18n['no-image-selected']);
     foreach ($fields as $key => $field) {
         if ($field['type'] != 'image') {
             continue;
         }
         $fields[$key]['buttonLabels'] = $default_image_button_labels;
     }
     $this->json['fields'] = $fields;
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     if (is_array($this->choices)) {
         foreach ($this->choices as $choice => $value) {
             if (true === $value) {
                 $this->json['choices'][$choice] = true;
             }
         }
     }
     if (is_array($this->json['default'])) {
         foreach ($this->json['default'] as $key => $value) {
             if (isset($this->json['choices'][$key]) && !isset($this->json['value'][$key])) {
                 $this->json['value'][$key] = $value;
             }
         }
     }
 }
 public function to_json()
 {
     parent::to_json();
     $this->json['choicesLength'] = 0;
     if (is_array($this->choices) && count($this->choices)) {
         $this->json['choicesLength'] = count($this->choices);
     }
     $values = $this->value() == '' ? array_keys($this->choices) : $this->value();
     $filtered_values = array();
     foreach ($values as $key => $value) {
         if (array_key_exists($value, $this->choices)) {
             $filtered_values[$key] = $value;
         }
     }
     $this->json['filteredValues'] = $filtered_values;
     $this->json['invisibleKeys'] = array_diff(array_keys($this->choices), $filtered_values);
     $this->json['inputAttrs'] = maybe_serialize($this->input_attrs());
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $fields = $this->fields;
     $this->json['fields'] = $fields;
     $this->json['row_label'] = $this->row_label;
     // If filtered_value has been set and is not empty we use it instead of the actual value.
     if (is_array($this->filtered_value) && !empty($this->filtered_value)) {
         $this->json['value'] = $this->filtered_value;
     }
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['multiple'] = $this->multiple;
 }
 public function to_json()
 {
     parent::to_json();
     $this->json['palette'] = $this->palette;
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['palette'] = $this->palette;
     $this->choices['alpha'] = isset($this->choices['alpha']) && $this->choices['alpha'] ? 'true' : 'false';
 }
 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['icons'] = Kirki_Helper::get_dashicons();
 }
 public function to_json()
 {
     parent::to_json();
     $this->json['fields'] = $this->fields;
 }