Example #1
0
 /**
  * Return field value
  *
  * @return mixed
  */
 public function getValue()
 {
     $value = parent::getValue();
     if (true === $value || '1' === $value || 'Y' === $value) {
         $value = 1;
     } elseif (false === $value || '0' === $value || 'N' === $value) {
         $value = 0;
     }
     return $value;
 }
Example #2
0
 /**
  * Return field value
  *
  * @return mixed
  */
 public function getValue()
 {
     $value = parent::getValue();
     if ($value === true || $value === '1' || $value === 1) {
         $value = static::YES;
     } elseif ($value === false || $value === '0' || $value === 0) {
         $value = static::NO;
     }
     return $value;
 }
Example #3
0
 /**
  * Get current wave value
  *
  * @return string
  */
 public function getValue()
 {
     $value = parent::getValue();
     $waves = $this->getWaves();
     if ($waves) {
         if (empty($value) || !isset($waves[$value]) && !is_numeric($value)) {
             $waveKeys = array_keys($waves);
             $value = array_pop($waveKeys);
         }
     }
     return $value;
 }
Example #4
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_IS_MANDATORY => new \XLite\Model\WidgetParam\Bool('Is mandatory', false, false), static::PARAM_ALLOWED_OPTIONS => new \XLite\Model\WidgetParam\Collection('Allowed options', null));
 }
Example #5
0
 /**
  * Set common attributes
  *
  * @param array $attrs Field attributes to prepare
  *
  * @return array
  */
 protected function setCommonAttributes(array $attrs)
 {
     $attrs = parent::setCommonAttributes($attrs);
     $attrs['data-value'] = $this->getValue();
     return $attrs;
 }
Example #6
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_USE_CODE_AS_KEY => new \XLite\Model\WidgetParam\Bool('Use currency codes as keys', false));
 }
Example #7
0
 /**
  * Assemble classes
  *
  * @param array $classes Classes
  *
  * @return array
  */
 public function assembleClasses(array $classes)
 {
     $classes = parent::assembleClasses($classes);
     $classes[] = 'not-significant';
     return $classes;
 }
Example #8
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_ORDER => new \XLite\Model\WidgetParam\String('Order', ''));
 }
Example #9
0
 /**
  * Get common attributes
  *
  * @return array
  */
 protected function getCommonAttributes()
 {
     $attributes = parent::getCommonAttributes();
     $value = $this->getValue();
     if (!$this->getMethod() && $this->getOrderEntity()->getShippingMethodName()) {
         $value = static::KEY_DELETED;
     }
     if ($this->getMethod() && !in_array($this->getMethod()->getMethodId(), array_keys($this->shippingOptions))) {
         $value = static::KEY_UNAVAILABLE;
     }
     $attributes['data-value'] = $value;
     $attributes['data-request-options'] = !$this->isBuildOptions();
     return $attributes;
 }
Example #10
0
 /**
  * Return field value
  *
  * @return mixed
  */
 public function getValue()
 {
     return parent::getValue() ?: 'C';
 }
Example #11
0
File: Rich.php Project: kingsj/core
 /**
  * Prepare attributes
  *
  * @param array $attrs Field attributes to prepare
  *
  * @return array
  */
 protected function prepareAttributes(array $attrs)
 {
     $attrs = parent::prepareAttributes($attrs);
     $attrs['class'] = (empty($attrs['class']) ? '' : $attrs['class'] . ' ') . 'rich';
     return $attrs;
 }
Example #12
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_ATTRIBUTE => new \XLite\Model\WidgetParam\Object('Attribute', null, false, 'XLite\\Model\\Attribute'), self::PARAM_PRODUCT => new \XLite\Model\WidgetParam\Object('Product', null, false, 'XLite\\Model\\Product'));
 }
Example #13
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_E => new \XLite\Model\WidgetParam\Int('Exp part', 2));
 }
Example #14
0
 /**
  * Check if widget is visible
  *
  * @return boolean
  */
 protected function isVisible()
 {
     return parent::isVisible() && 1 < count($this->getParam(static::PARAM_AVAILABLE_TYPES));
 }
Example #15
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_COUNTRY => new \XLite\Model\WidgetParam\String('Country', ''));
 }
Example #16
0
 /**
  * Register CSS files
  *
  * @return array
  */
 public function getCSSFiles()
 {
     $list = parent::getCSSFiles();
     $list[] = 'modules/XC/ProductFilter/form_field/select/use_classes/style.css';
     return $list;
 }
Example #17
0
 /**
  * getOptions
  *
  * @return array
  */
 protected function getOptions()
 {
     return array('' => 'Select one...') + parent::getOptions();
 }
Example #18
0
 /**
  * Set common attributes
  *
  * @param array $attrs Field attributes to prepare
  *
  * @return array
  */
 protected function setCommonAttributes(array $attrs)
 {
     return parent::setCommonAttributes($attrs) + array('data-placeholder' => static::t('Select options'), 'data-selected-text' => static::t('# selected'), 'data-disable-search' => $this->getParam(static::PARAM_DISABLE_SEARCH));
 }
Example #19
0
 /**
  * Return field value
  *
  * @return mixed
  */
 public function getValue()
 {
     return intval(parent::getValue());
 }
Example #20
0
 /**
  * Get value container class
  *
  * @return string
  */
 protected function getValueContainerClass()
 {
     return parent::getValueContainerClass() . ' country-selector';
 }
Example #21
0
 /**
  * Set common attributes
  *
  * @param array $attrs Field attributes to prepare
  *
  * @return array
  */
 protected function setCommonAttributes(array $attrs)
 {
     return parent::setCommonAttributes($attrs) + array('size' => 1);
 }
Example #22
0
 /**
  * Check - current value is selected or not
  *
  * @param mixed $value Value
  *
  * @return boolean
  */
 protected function isOptionSelected($value)
 {
     return $this->getValue() ? parent::isOptionSelected($value) : $value == date_default_timezone_get();
 }
Example #23
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_ORDER_ID => new \XLite\Model\WidgetParam\Int('Order ID', null, false), self::PARAM_ALL_OPTION => new \XLite\Model\WidgetParam\Bool('Show "All" option', false, false));
 }
Example #24
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_ORDER => new \XLite\Model\WidgetParam\Object('Order', null, false, '\\XLite\\Model\\Order'), self::PARAM_ALL_OPTION => new \XLite\Model\WidgetParam\Bool('Show "All status" option', false, false));
 }
Example #25
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_ALL_OPTION => new \XLite\Model\WidgetParam\Bool('Show "All statuses" option', false, false));
 }
Example #26
0
 /**
  * Return field value
  *
  * @return mixed
  */
 public function getValue()
 {
     return parent::getValue() ?: static::SKIN_STANDARD;
 }
Example #27
0
 /**
  * Set common attributes
  *
  * @param array $attrs Field attributes to prepare
  *
  * @return array
  */
 protected function setCommonAttributes(array $attrs)
 {
     $list = parent::setCommonAttributes($attrs);
     $list['onchange'] = 'javascript: if (this.form.weight_symbol) { this.form.weight_symbol.value = this.value; }';
     return $list;
 }