public function display_field(ContactField $field) { $fieldset = $field->get_fieldset(); $regex = $field->get_regex(); switch ($regex) { case 1: $field_class = 'FormFieldNumberEditor'; $display_constraint = false; break; case 4: $field_class = 'FormFieldMailEditor'; $display_constraint = false; break; case 5: $field_class = 'FormFieldUrlEditor'; $display_constraint = false; break; case 8: $field_class = 'FormFieldTelEditor'; $display_constraint = false; break; default: $field_class = 'FormFieldTextEditor'; $display_constraint = true; break; } $fieldset->add_field(new $field_class($field->get_field_name(), $field->get_name(), $field->get_default_value(), array('required' => (bool) $field->is_required(), 'description' => $field->get_description()), $display_constraint ? array($this->constraint($regex)) : array())); }
public function display_field(ContactField $field) { $fieldset = $field->get_fieldset(); $fieldset->add_field(new FormFieldShortMultiLineTextEditor($field->get_field_name(), $field->get_name(), $field->get_default_value(), array('required' => (bool) $field->is_required(), 'rows' => 10, 'cols' => 80, 'description' => $field->get_description()), array($this->constraint($field->get_regex())))); }