/** * Form Widget Name Modifiers * Add a number dimension to the form name * Compatible with widget preview prototype (__i__) * * @return string */ public function getNameIdentifier() { $name = parent::getNameIdentifier(); if ($this->getFormType()->getType() == 'widget') { $name = preg_replace('/-(\\d|__i__)/', '[$1]', $name); } return $name; }
/** * Get the form name identifier * * @return string */ public function getNameIdentifier() { $identifier = parent::getNameIdentifier(); if ($this->isMultiple()) { $identifier .= '[]'; } return $identifier; }
/** * Add a children Form * * @param string $key * @param \PopCode\Framework\Form\Form $form * @return \PopCode\Framework\Form\Form */ public function add($key, \PopCode\Framework\Form\Form $form) { //set the name and id related to parent $form->setName($this->getId() . '[' . $form->getId() . ']'); $form->setParent($this); $this->children[$key] = $form; return $this; }