choices)) { return; } ?> icon_array = $args['icon_array']; } parent::__construct($manager, $id, $args); } public function render_content() { ?> choices)) { return; } ?> label); ?> description) { ?> description); ?> value()) ? explode(',', $this->value()) : $this->value(); ?>
get_button_labels(); $this->button_labels = apply_filters('business_shuffle_customizer_background_button_labels', $button_labels, $id); // Set field labels $field_labels = $this->get_field_labels(); $this->field_labels = apply_filters('business_shuffle_customizer_background_field_labels', $field_labels, $id); // Set background choices $background_choices = $this->get_background_choices(); $this->background_choices = apply_filters('business_shuffle_customizer_background_choices', $background_choices, $id); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function to_json() { parent::to_json(); $background_choices = $this->background_choices; $field_labels = $this->field_labels; // Loop through each of the settings and set up the data for it. foreach ($this->settings as $setting_key => $setting_id) { $this->json[$setting_key] = array( 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), 'label' => isset($field_labels[$setting_key]) ? $field_labels[$setting_key] : '' ); if ('image_url' === $setting_key) { if ($this->value($setting_key)) { // Get the attachment model for the existing file. $attachment_id = attachment_url_to_postid($this->value($setting_key)); if ($attachment_id) { $this->json['attachment'] = wp_prepare_attachment_for_js($attachment_id); } } } elseif ('repeat' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['repeat']; } elseif ('size' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['size']; } elseif ('position' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['position']; } elseif ('attach' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['attach']; } } } /** * Render a JS template for the content of the media control. * * @since 1.0.0 */ public function content_template() { parent::content_template(); ?>