public function addElement(Daq_Form_Element $field, $group = null) { $this->_field[$field->getName()] = $field; if ($group !== null) { if (!is_array($this->_group[$group])) { $this->addGroup($group); } $this->_group[$group]["element"][] = $field->getName(); } }
function wpjb_form_input_features(Daq_Form_Element $e) { $cl = array(); if (count($e->getErrors()) > 0) { $cl[] = "wpjb-error"; } $cl[] = "wpjb-element-" . $e->getTypeTag(); $cl[] = "wpjb-element-name-" . $e->getName(); echo join(" ", $cl); }
public function render(Daq_Form_Element $element) { $label = true; if ($element->getType() == Daq_Form_Element::TYPE_CHECKBOX) { $label = false; } if ($element->getType() == Daq_Form_Element::TYPE_RADIO) { $label = false; } if ($element->hasErrors()) { $c = '<tr valign="top" class="error">'; } else { $c = '<tr valign="top">'; } if ($element->isRequired()) { $req = '<span class="wpjb-red"> *</span>'; } else { $req = ''; } $c .= ' <th scope="row">'; if ($label) { $c .= ' <label for="' . $element->getName() . '">' . $element->getLabel() . $req . '</label>'; } else { $c .= ' ' . $element->getLabel() . $req; } $c .= ' </th>'; $c .= ' <td>'; $c .= $this->renderTag($element); $c .= ' <br />'; if ($element->hasHint()) { $c .= ' <span class="setting-description">' . $this->_escape($element->getHint()) . '</span>'; } if ($element->hasErrors()) { $c .= ' <ul class="updated">'; $c .= ' <li><strong>Following errors occured</strong></li>'; foreach ($element->getErrors() as $error) { $c .= ' <li>' . $error . '</li>'; } $c .= ' </ul>'; } $c .= ' </td>'; $c .= '</tr>'; return $c; }