/** * Add a field, optionally changing its control name to disambiguate it * from other fields with the same control name on this page. * * @param DbField $field * @param string $groupName * @return \Dewdrop\Fields\Edit */ public function add(DbField $field, $groupName = null) { if (null === $groupName) { $this->fields[$field->getControlName()] = $field; } else { $fieldIndex = $groupName . ':' . $field->getName(); $field->setControlName($fieldIndex); $this->fields[$fieldIndex] = $field; } $this->inputFilter->add($field->getInputFilter()); return $this; }