public function addComponent(Component $component) { if ($component instanceof Field) { $component->setFieldComponentRenderer($this->defaultFieldComponentRenderer); } parent::addComponent($component); }
public function getFormIdentifierAsString() { $multiBraces = $this->index !== null ? '[' . $this->index . ']' : null; if ($this->parentComponent === null || $this->parentComponent instanceof Form) { return $this->getName() . $multiBraces; } return $this->parentComponent->getFormIdentifierAsString() . '[' . $this->getName() . ']' . $multiBraces; }
/** * Connects a component with the form handler instance * @param Component $component The form component to add */ public function addComponent(Component $component) { $component->setParentComponent($this); $component->setFormComponent($this->formComponent); $this->components[$component->getName()] = $component; // Set value if there is one $component->setRequestData(is_array($this->inputData) && array_key_exists($component->getName(), $this->inputData) ? $this->inputData[$component->getName()] : null); }
/** * @param string $name The name of the field in the HTTP request * @param string $label The label of the field * @param array $ruleSet */ public function __construct($name, $label, array $ruleSet = array()) { parent::__construct($name); $this->id = $name; $this->label = $label; $this->ruleSet = $ruleSet; $this->errors = array(); $this->validated = false; $this->value = null; $this->linkedLabel = true; $this->fieldComponentRenderer = new DefaultFieldComponentRenderer(); }