/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(array('value' => 'true', 'label' => isset($args['true']) ? $args['true'] : __('True', kopa_get_domain())), array('value' => 'false', 'label' => isset($args['false']) ? $args['false'] : __('False', kopa_get_domain()))); $this->control_begin = $this->control_begin . '<div class="row clearfix">'; $this->control_end = '</div>' . $this->control_end; $this->option_args['wrap_begin'] = '<div class="col-xs-4 col-sm-4 col-md-2">'; $this->option_args['wrap_end'] = '</div>'; $this->option_args['label_begin'] = ''; $this->option_args['label_end'] = ''; $this->option_args['control_begin'] = ''; $this->option_args['control_end'] = ''; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(); $this->colors = isset($args['colors']) ? $args['colors'] : array(); foreach ($this->colors as $color) { $tmp = array(); $tmp['attributes']['data-primary'] = $color['primary']; $tmp['attributes']['data-primary'] = $color['secondary']; $tmp['value'] = "{$color['primary']}_{$color['secondary']}"; $tmp['control_begin'] = sprintf('<label onclick="KopaUI.change_swatches(event, jQuery(this));" data-primary="%1$s" data-secondary="%2$s" for="%3$s" class="color-swatches-item" style="border-color: %1$s !important;">', $color['primary'], $color['secondary'], "{$this->name}-{$tmp['value']}"); $tmp['control_begin'] .= sprintf('<span class="color-swatches-primary" style="background-color: %s;"></span>', $color['primary']); $tmp['control_begin'] .= sprintf('<span class="color-swatches-secondary" style="background-color: %s;"></span>', $color['secondary']); $tmp['control_end'] = '</label>'; $this->options[] = $tmp; } $this->option_args['wrap_begin'] = '<div class="col-xs-4 col-md-2 color-swatches-outer">'; $this->option_args['wrap_end'] = '</div>'; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(); $this->colors = isset($args['colors']) ? $args['colors'] : array(); foreach ($this->colors as $color) { $tmp = array(); $tmp['attributes']['data-primary'] = $color['primary']; $tmp['value'] = $color['primary']; if ('customize' == $tmp['value']) { $tmp['control_begin'] = sprintf('<label onclick="KopaUI.select_colorSwatchesSingle(event, jQuery(this));" data-primary="customize" for="%s" class="color-swatches-item color-swatches-single-customize">', "{$this->name}-{$tmp['value']}"); $tmp['control_begin'] .= sprintf('<span class="color-swatches-primary">%1$s</span>', $color['label']); } else { $tmp['control_begin'] = sprintf('<label onclick="KopaUI.select_colorSwatchesSingle(event, jQuery(this));" data-primary="%1$s" for="%2$s" class="color-swatches-item" style="border-color: %1$s !important;">', $color['primary'], "{$this->name}-{$tmp['value']}"); $tmp['control_begin'] .= sprintf('<span class="color-swatches-primary %3$s" style="background-color: %1$s;">%2$s</span>', $color['primary'], $color['label'], implode(' ', $color['classes'])); } $tmp['control_end'] = '</label>'; $this->options[] = $tmp; } $this->control_begin = $this->control_begin . '<div class="row row_space15 clearfix">'; $this->control_end = '</div>' . $this->control_end; $this->option_args['wrap_begin'] = '<div class="col-xs-4 col-md-1 color-swatches-outer color-swatches-single-outer">'; $this->option_args['wrap_end'] = '</div>'; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->dir_abs = isset($args['dir_abs']) ? $args['dir_abs'] : false; $this->dir_rel = isset($args['dir_rel']) ? $args['dir_rel'] : false; if ($this->dir_abs && $this->dir_rel) { $this->options = array(); $path = $this->dir_abs . '*.png'; $files = glob($path); if ($files) { foreach ($files as $file) { $file_name = basename($file); $label_class = $this->value == $file_name ? 'active' : ''; $tmp = array(); $tmp['value'] = $file_name; $tmp['control_begin'] = sprintf('<label onclick="kopa_pattern_change(event, jQuery(this));" style="background-image: url(%1$s);" for="%2$s" class="radio-pattern-item %3$s">', $this->dir_rel . '/' . $file_name, "{$this->name}-{$tmp['value']}", $label_class); $tmp['control_end'] = '</label>'; $this->options[] = $tmp; } } $this->option_args['wrap_begin'] = '<div class="col-xs-4 col-md-2 radio-pattern-outer">'; $this->option_args['wrap_end'] = '</div>'; } }