Exemple #1
0
 public function __toString()
 {
     if ('markdown' === $this->_engine) {
         return $this->_parser->transformMarkdown($this->_value);
     }
     return parent::__toString();
 }
Exemple #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);
 }
Exemple #4
0
 public function setValue($value)
 {
     if ($value === '' || $value === null) {
         $value = null;
     } else {
         $value = (int) $value;
     }
     parent::setValue($value);
 }
Exemple #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());
 }
Exemple #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());
 }