Example #1
0
    protected function render_after_field($value, $instance)
    {
        ?>
		</div>
		<?php 
        parent::render_after_field($value, $instance);
    }
    protected function render_after_field($value, $instance)
    {
        $unit_name = $this->get_unit_field_name($this->base_name);
        $unit = !empty($instance[$unit_name]) ? $instance[$unit_name] : '';
        ?>
		<select class="sow-measurement-select-unit"
				name="<?php 
        echo esc_attr($this->for_widget->so_get_field_name($this->base_name . '_unit', $this->parent_container));
        ?>
">
			<?php 
        foreach (siteorigin_widgets_get_measurements_list() as $measurement) {
            ?>
				<option value="<?php 
            echo esc_attr($measurement);
            ?>
" <?php 
            selected($measurement, $unit, true);
            ?>
><?php 
            echo esc_html($measurement);
            ?>
</option>
			<?php 
        }
        ?>
		</select>
		<div class="clear"></div>
		<?php 
        //Still want the default description, if there is one.
        parent::render_after_field($value, $instance);
    }
 protected function initialize()
 {
     parent::initialize();
     if (!empty($this->button_filters)) {
         foreach ($this->button_filters as $filter_name => $filter) {
             if (preg_match('/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name) && !empty($filter) && is_callable($filter)) {
                 add_filter($filter_name, array($this, $filter_name), 10, 2);
             }
         }
     }
 }
    protected function render_after_field($value, $instance)
    {
        $value_parts = $this->get_render_values($value);
        $unit = $value_parts['unit'];
        if (is_null($unit)) {
            $unit_name = $this->get_unit_field_name($this->base_name);
            if (!empty($instance[$unit_name])) {
                $unit = $instance[$unit_name];
            } else {
                if (isset($this->default)) {
                    $default_parts = $this->get_render_values($this->default);
                    $unit = $default_parts['unit'];
                }
            }
        }
        ?>
		<select class="sow-measurement-select-unit siteorigin-widget-input"
				name="<?php 
        echo esc_attr($this->for_widget->so_get_field_name($this->base_name . '_unit', $this->parent_container));
        ?>
">
			<?php 
        foreach (siteorigin_widgets_get_measurements_list() as $measurement) {
            ?>
				<option value="<?php 
            echo esc_attr($measurement);
            ?>
" <?php 
            selected($measurement, $unit, true);
            ?>
><?php 
            echo esc_html($measurement);
            ?>
</option>
			<?php 
        }
        ?>
		</select>
		<div class="clear"></div>
		<?php 
        //Still want the default description, if there is one.
        parent::render_after_field($value, $instance);
    }
Example #5
0
 protected function initialize()
 {
     parent::initialize();
     add_filter('mce_buttons', array($this, 'mce_buttons_filter'), 10, 2);
     add_filter('quicktags_settings', array($this, 'quicktags_settings'), 10, 2);
     if (!empty($this->button_filters)) {
         foreach ($this->button_filters as $filter_name => $filter) {
             if (preg_match('/mce_buttons(?:_[1-4])?|quicktags_settings/', $filter_name) && !empty($filter) && is_callable($filter)) {
                 add_filter($filter_name, array($this, $filter_name), 10, 2);
             }
         }
     }
     if (class_exists('WC_Shortcodes_Admin')) {
         $screen = get_current_screen();
         if (!is_null($screen) && $screen->id != 'widgets') {
             add_filter('mce_external_plugins', array($this, 'add_wc_shortcode_plugin'), 15);
             add_filter('mce_buttons', array($this, 'register_wc_shortcode_button'), 15);
         }
     }
 }
Example #6
0
 protected function get_input_classes()
 {
     $input_classes = parent::get_input_classes();
     $input_classes[] = 'siteorigin-widget-input-number';
     return $input_classes;
 }
Example #7
0
 protected function render_before_field($value, $instance)
 {
     $selected_editor_name = $this->get_selected_editor_field_name($this->base_name);
     if (!empty($instance[$selected_editor_name])) {
         $this->selected_editor = $instance[$selected_editor_name];
     } else {
         $this->selected_editor = $this->default_editor;
     }
     parent::render_before_field($value, $instance);
 }
 protected function get_input_classes()
 {
     $input_classes = parent::get_input_classes();
     $input_classes[] = 'lsow-widget-input-timepicker';
     return $input_classes;
 }