Example #1
0
 /**
  * getCommonAttributes
  *
  * @return array
  */
 protected function getCommonAttributes()
 {
     $list = parent::getCommonAttributes();
     if ($this->getParam(static::PARAM_PLACEHOLDER)) {
         $list['placeholder'] = $this->getParam(static::PARAM_PLACEHOLDER);
     }
     return array_merge($list, array('type' => $this->getFieldType(), 'value' => $this->getValue()));
 }
Example #2
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_ROWS => new \XLite\Model\WidgetParam\Int('Rows', $this->getDefaultRows()), static::PARAM_COLS => new \XLite\Model\WidgetParam\Int('Cols', $this->getDefaultCols()));
 }
Example #3
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_LIST_CLASS => new \XLite\Model\WidgetParam\String('List class', ''));
 }
Example #4
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_MIN_COUNT => new \XLite\Model\WidgetParam\Int('Minimum symbols count after which the search will be permitted', $this->getDefaultMinCount(), false), static::PARAM_EMPTY_PHRASE => new \XLite\Model\WidgetParam\String('Text for the empty list', $this->getDefaultEmptyPhrase(), false), static::PARAM_EMPTY_MODEL_DEFINITION => new \XLite\Model\WidgetParam\String('Text when no model is selected', $this->getDefaultEmptyModelDefinition(), false), static::PARAM_GETTER => new \XLite\Model\WidgetParam\String('URL which will be the getter of the search objects', $this->getDefaultGetter(), false), static::PARAM_PLACEHOLDER => new \XLite\Model\WidgetParam\String('Text for the placeholder', '', false), static::PARAM_IS_MODEL_REQUIRED => new \XLite\Model\WidgetParam\Bool('Flag if the model required to be selected', true, false));
 }
Example #5
0
 /**
  * Get item class
  *
  * @param integer                          $index  Item index
  * @param integer                          $length Items list length
  * @param \XLite\View\FormField\AFormField $field  Current item
  *
  * @return string
  */
 protected function getItemClass($index, $length, \XLite\View\FormField\AFormField $field)
 {
     $data = $this->getCountryStateSelectorFields();
     foreach ($data as $countryField => $stateFields) {
         if ($stateFields[1] === $field->getName()) {
             $this->rowIndexDelta++;
         }
     }
     $index += $this->rowIndexDelta;
     $classes = parent::getItemClass($index, $length, $field);
     return $classes;
 }
Example #6
0
 /**
  * Get default wrapper class
  *
  * @return string
  */
 protected function getDefaultWrapperClass()
 {
     return trim(parent::getDefaultWrapperClass() . ' image-selector');
 }
Example #7
0
 /**
  * Return name of the folder with templates
  *
  * @return string
  */
 protected function getDir()
 {
     return parent::getDir() . '/separator';
 }
Example #8
0
 /**
  * Register files from common repository
  *
  * @return array
  */
 public function getCommonFiles()
 {
     $list = parent::getCommonFiles();
     $list[static::RESOURCE_JS][] = 'js/jquery.blockUI.js';
     return $list;
 }
Example #9
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_OPTIONS => new \XLite\Model\WidgetParam\Collection('Options', $this->getDefaultOptions(), false), self::PARAM_LABEL_FROM => new \XLite\Model\WidgetParam\String('Label FROM', $this->getDefaultLabelFrom(), false), self::PARAM_LABEL_TO => new \XLite\Model\WidgetParam\String('Label TO', $this->getDefaultLabelTo(), false));
 }
Example #10
0
 /**
  * Get value container class
  *
  * @return string
  */
 protected function getValueContainerClass()
 {
     return parent::getValueContainerClass() . $this->getCommonClass();
 }
Example #11
0
 /**
  * getCommonAttributes
  *
  * @return array
  */
 protected function getCommonAttributes()
 {
     $list = parent::getCommonAttributes();
     if ($this->getParam(static::PARAM_MULTIPLE)) {
         $list['multiple'] = $this->getParam(static::PARAM_MULTIPLE);
     }
     $list['max_width'] = $this->getParam(static::PARAM_MAX_WIDTH);
     $list['max_height'] = $this->getParam(static::PARAM_MAX_HEIGHT);
     return $list;
 }
Example #12
0
 /**
  * getCommonAttributes
  *
  * @return array
  */
 protected function getCommonAttributes()
 {
     return parent::getCommonAttributes() + array('type' => $this->getFieldType(), 'value' => $this->getValue());
 }
Example #13
0
 /**
  * getDefaultValue
  *
  * @return string
  */
 protected function getDefaultValue()
 {
     $value = parent::getDefaultValue();
     if (is_object($value) && $value instanceof \XLite\Model\AEntity) {
         $value = $value->getUniqueIdentifier();
     }
     return $value;
 }
Example #14
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(static::PARAM_UNESCAPE => new \XLite\Model\WidgetParam\Bool('Un-escape value', false));
 }
Example #15
0
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_OPTIONS => new \XLite\Model\WidgetParam\Collection('Options', $this->getDefaultOptions(), false));
 }
Example #16
0
 /**
  * Check dependency
  *
  * @param \XLite\View\FormField\AFormField $field Field
  *
  * @return boolean
  */
 protected function checkDependency($field)
 {
     $dependency = $field->getParam(\XLite\View\FormField\AFormField::PARAM_DEPENDENCY);
     $result = true;
     foreach ($dependency as $depType => $dependencies) {
         foreach ($dependencies as $depField => $depValue) {
             if (static::DEPENDENCY_SHOW == $depType) {
                 if ($this->checkRequestHasExpectedValue($depField, $depValue)) {
                     if (false !== $result) {
                         $result = true;
                     }
                 } else {
                     $result = false;
                 }
             } else {
                 if ($this->checkRequestHasExpectedValue($depField, $depValue)) {
                     $result = false;
                 } else {
                     if (false !== $result) {
                         $result = true;
                     }
                 }
             }
         }
     }
     return $result;
 }
Example #17
0
 /**
  * Get item class
  *
  * @param integer                          $index  Item index
  * @param integer                          $length items list length
  * @param \XLite\View\FormField\AFormField $field  Current item
  *
  * @return string
  */
 protected function getItemClass($index, $length, \XLite\View\FormField\AFormField $field)
 {
     $classes = preg_grep('/.+/Ss', array_map('trim', explode(' ', $field->getWrapperClass())));
     if (0 === $index % 2) {
         $classes[] = 'even';
     }
     if (1 === $index) {
         $classes[] = 'first';
     }
     if ($length == $index) {
         $classes[] = 'last';
     }
     return implode(' ', $classes);
 }