/** * Create a new instance of this form field. * @param string $name * @param array $options */ public function __construct($name, $options = array()) { parent::__construct($name, $options); $this->enum_values = array(); $this->setupEnum(); }
/** * Return the I2CE_FormField for the given field name. * @param string $field the field name or a form name:field name * @return I2CE_FormField */ public function getField($field) { if (strpos($field, ':') !== false) { list($name, $field) = explode(':', $field, 2); if ($name !== $this->name) { I2CE::raiseError("Using wrong reference to container name {$name} != {$this->name}"); return null; } } if (array_key_exists($field, $this->fields)) { return $this->fields[$field]; } elseif ($field == "id") { $form_field = new I2CE_FormField_STRING_LINE("id", array('in_db' => false)); $form_field->setValue($this->getNameId()); $form_field->setContainer($this); return $form_field; } else { return null; } }
public function getFieldObj() { if ($this->fieldObj instanceof I2CE_FormField) { return $this->fieldObj; } $formObj = $this->getFormObj(); if (!$formObj instanceof I2CE_Form) { return false; } if ($this->name == 'id') { $fieldObj = new I2CE_FormField_STRING_LINE('id'); $fieldObj->setContainer($formObj); } else { $fieldObj = $formObj->getField($this->name); if (!$fieldObj instanceof I2CE_FormField) { return false; } } $this->fieldObj = $fieldObj; return $this->fieldObj; }