- $this->add('text', $field['name'],
- $field['label'], $attributes[$field['name']]
- );
- $this->add('text', "test_{$field['name']}",
+ $this->addField($field['name'], array('label' => $field['label']));
+
+ $fieldSpec = civicrm_api3($this->getDefaultEntity(), 'getfield', array(
+ 'name' => $field['name'],
+ 'action' => 'create',
+ ));
+ $this->add($fieldSpec['values']['html']['type'], "test_{$field['name']}",