Пример #1
0
 /**
  * Detect form field class by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return string
  */
 protected function detectFormFieldClassByOption(\XLite\Model\Config $option)
 {
     return 'dimensions' === $option->getName() ? 'XLite\\View\\FormField\\Input\\Text\\Dimensions' : parent::detectFormFieldClassByOption($option);
 }
Пример #2
0
 /**
  * Sanitize option new value
  *
  * @param \XLite\Model\Config $option Config option
  * @param string              $value  New value
  *
  * @return string
  */
 protected function sanitizeOptionValue($option, $value)
 {
     $category = $option->getCategory();
     $name = $option->getName();
     $validationMethod = 'sanitize' . \Includes\Utils\Converter::convertToCamelCase($category) . \Includes\Utils\Converter::convertToCamelCase($name);
     if (method_exists($this, $validationMethod)) {
         $value = $this->{$validationMethod}($value);
     }
     $type = $option->getType();
     if ('checkbox' === $type) {
         $result = empty($value) ? 'N' : 'Y';
     } elseif ('serialized' === $type && null !== $value && is_array($value)) {
         $result = serialize($value);
     } elseif ('text' === $type) {
         $result = null !== $value ? trim($value) : '';
     } elseif ('XLite\\View\\FormField\\Input\\PasswordWithValue' === $type) {
         $result = null !== $value ? $value : null;
     } else {
         $result = null !== $value ? $value : '';
     }
     return $result;
 }
Пример #3
0
 /**
  * Detect form field class by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return string
  */
 protected function detectFormFieldClassByOption(\XLite\Model\Config $option)
 {
     return $this->isCountriesSelector($option->getName()) ? 'XLite\\Module\\XC\\PitneyBowes\\View\\FormField\\Select\\Country' : parent::detectFormFieldClassByOption($option);
 }
Пример #4
0
 /**
  * {@inheritDoc}
  */
 public function getName()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', array());
     return parent::getName();
 }
Пример #5
0
 /**
  * Return true if option is visible
  *
  * @param \XLite\Model\Config $option Option object
  *
  * @return boolean
  */
 protected function isOptionVisible(\XLite\Model\Config $option)
 {
     $result = true;
     $method = 'isOption' . \XLite\Core\Converter::convertToCamelCase($option->getCategory() . '_' . $option->getName()) . 'Visible';
     if (method_exists($this, $method)) {
         // Call method 'isOption<Category><Name>Visible'
         $result = $this->{$method}();
     }
     return $result;
 }