/** * {@inhertidoc} */ public function __construct(string $name, FieldInterface $valueField) { if ($valueField instanceof ArrayField) { throw new \InvalidArgumentException("unexpected value provided for 'valueField'; nesting " . "instances of " . __CLASS__ . " is not permitted"); } parent::__construct($name); $this->valueField = $valueField->setParent($this); $this->defaultValue = []; }
/** * @param FieldInterface|string $childName * @return FormInterface|FALSE */ public function remove($childName) { foreach ($this->children as $child) { /** @var FieldInterface $child */ $isMatchingInstance = TRUE === $childName instanceof FormInterface && $childName->getName() === $child->getName(); $isMatchingName = $childName === $child->getName(); if (TRUE === $isMatchingName || TRUE === $isMatchingInstance) { $this->children->detach($child); $this->children->rewind(); $child->setParent(NULL); return $child; } } return FALSE; }
/** * Repeats the given field twice to verify the user's input. * * @param FieldInterface $innerField */ public function __construct(FieldInterface $innerField, array $options = array()) { $this->prototype = $innerField; parent::__construct($innerField->getKey(), $options); }
public function addField(FieldInterface $field) { $this->fields[$field->getName()] = $field; }
/** * @param FieldInterface $field * @param array $result */ private function fieldToFlatList(FieldInterface $field, array &$result) { if ($field instanceof CompositeField) { foreach ($field->getFields() as $subfield) { $this->fieldToFlatList($subfield, $result); } } else { $result[$field->getName()] = $field; } }
public function add(FieldInterface $field) { $this->_fields[$field->getFieldType()] = $field; }
public function __construct(string $name, ValueField $keyField, FieldInterface $valueField) { parent::__construct($name); $this->keyField = $keyField->setParent($this); $this->valueField = $valueField->setParent($this); }