Ejemplo n.º 1
0
 public function __toString()
 {
     if ('markdown' === $this->_engine) {
         return $this->_parser->transformMarkdown($this->_value);
     }
     return parent::__toString();
 }
Ejemplo n.º 2
0
 public function setFieldOptions(array $options)
 {
     if (array_key_exists('multiple', $options) && $options['multiple'] === true) {
         throw new \LogicException('For multiple choice fields, use the `multichoice` field type');
     }
     return parent::setFieldOptions($options);
 }
 public function setValue($value)
 {
     if (!is_numeric($value) || (int) $value != $value) {
         throw new \InvalidArgumentException('Value must be a Bundle ID and therefore a whole number');
     }
     parent::setValue((int) $value);
 }
Ejemplo n.º 4
0
 public function setValue($value)
 {
     if ($value === '' || $value === null) {
         $value = null;
     } else {
         $value = (int) $value;
     }
     parent::setValue($value);
 }
Ejemplo n.º 5
0
 public function setValue($value)
 {
     if (is_scalar($value) && (string) $value === '') {
         $value = null;
     }
     if (null !== $value && !$value instanceof \DateTime) {
         if (!is_scalar($value)) {
             throw new \InvalidArgumentException('Value must be a scalar type or a DateTime');
         }
         try {
             $value = $this->_isTimestamp($value) ? new DateTimeImmutable(date('c', $value)) : new DateTimeImmutable($value);
         } catch (\Exception $e) {
             throw new \LogicException('Could not create DateTime from `' . $value . '`');
         }
     }
     parent::setValue($value);
 }
 public function getFieldOptions()
 {
     $defaults = ['choices' => $this->_products, 'empty_value' => 'Please select a product...'];
     return array_merge($defaults, parent::getFieldOptions());
 }
Ejemplo n.º 7
0
 public function getValue()
 {
     return parent::getValue();
 }
 public function getFieldOptions()
 {
     $defaults = ['choices' => $this->_getChoices(), 'allowed_types' => $this->_allowedTypes ?: false, 'empty_value' => $this->_translator->trans('ms.file_manager.select.default')];
     return array_merge($defaults, parent::getFieldOptions());
 }