/** * 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())); }
/** * 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())); }
/** * Define widget params * * @return void */ protected function defineWidgetParams() { parent::defineWidgetParams(); $this->widgetParams += array(self::PARAM_LIST_CLASS => new \XLite\Model\WidgetParam\String('List class', '')); }
/** * 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)); }
/** * 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; }
/** * Get default wrapper class * * @return string */ protected function getDefaultWrapperClass() { return trim(parent::getDefaultWrapperClass() . ' image-selector'); }
/** * Return name of the folder with templates * * @return string */ protected function getDir() { return parent::getDir() . '/separator'; }
/** * Register files from common repository * * @return array */ public function getCommonFiles() { $list = parent::getCommonFiles(); $list[static::RESOURCE_JS][] = 'js/jquery.blockUI.js'; return $list; }
/** * 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)); }
/** * Get value container class * * @return string */ protected function getValueContainerClass() { return parent::getValueContainerClass() . $this->getCommonClass(); }
/** * 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; }
/** * getCommonAttributes * * @return array */ protected function getCommonAttributes() { return parent::getCommonAttributes() + array('type' => $this->getFieldType(), 'value' => $this->getValue()); }
/** * getDefaultValue * * @return string */ protected function getDefaultValue() { $value = parent::getDefaultValue(); if (is_object($value) && $value instanceof \XLite\Model\AEntity) { $value = $value->getUniqueIdentifier(); } return $value; }
/** * 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)); }
/** * 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)); }
/** * 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; }
/** * 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); }