/** * @return mixed */ public function getValue() { if ($this->isUnloaded()) { return null; } return parent::getValue(); }
/** * Set metadata * * @param mixed $key Data key * @param mixed $value Data value * * @return $this */ public function setMetadata($key, $value) { $data = $this->metadata->getValue(); $metadata = $this->encoder->decode($data); $metadata[$key] = $value; $data = $this->encoder->encode($metadata); $this->metadata->setValue($data); return $this; }
/** * {@inheritdoc} */ public function setValue($value) { if ($value === null) { $value = array(); } elseif (!Value::isArray($value)) { throw new InvalidArgumentException(sprintf("Field set value has invalid type: '%s'", gettype($value))); } return parent::setValue($value); }
/** * Add a field * * @param Field $field Field * * @return $this * @throws \LogicException */ public function addField(Field $field) { $name = $field->getName(); if ($this->hasField($name)) { throw new \LogicException(sprintf("Field '%s' already exist.", $name)); } $this->fields[$name] = $field; return $this; }
/** * @{@inheritdoc} */ public function __construct(Form $form, $name) { parent::__construct($form, $name); $this->addFilter(new Filter\StripTags($form->getContext())); }