/** * Creates an array representing an element containing * the key for storing this. We allow the parent to do most of the * work, but then we add some CiviCRM specific enhancements to * make the html compliant with our css etc * * @access private * @param object An HTML_QuickForm_element object * @param bool Whether an element is required * @param string Error associated with the element * @return array */ function _elementToArray(&$element, $required, $error) { CRM_Core_Form_Renderer::updateAttributes($element, $required, $error); $el = parent::_elementToArray($element, $required, $error); // add label html if (!empty($el['label'])) { $id = $element->getAttribute('id'); if (!empty($id)) { $el['label'] = '<label for="' . $id . '">' . $el['label'] . '</label>'; } } return $el; }
/** * Creates an array representing an element containing * the key for storing this. We allow the parent to do most of the * work, but then we add some CiviCRM specific enhancements to * make the html compliant with our css etc * * @access private * * @param object An HTML_QuickForm_element object * @param bool Whether an element is required * @param string Error associated with the element * * @return array */ function _elementToArray(&$element, $required, $error) { self::updateAttributes($element, $required, $error); $el = parent::_elementToArray($element, $required, $error); // add label html if (!empty($el['label'])) { $id = $element->getAttribute('id'); if (!empty($id)) { $el['label'] = '<label for="' . $id . '">' . $el['label'] . '</label>'; } else { $el['label'] = "<label>{$el['label']}</label>"; } } return $el; }
/** * Creates an array representing an element containing. * the key for storing this. We allow the parent to do most of the * work, but then we add some CiviCRM specific enhancements to * make the html compliant with our css etc * * * @param HTML_QuickForm_element $element * @param bool $required * Whether an element is required. * @param string $error * Error associated with the element. * * @return array */ public function _elementToArray(&$element, $required, $error) { self::updateAttributes($element, $required, $error); $el = parent::_elementToArray($element, $required, $error); // add label html if (!empty($el['label'])) { $id = $element->getAttribute('id'); if (!empty($id)) { $el['label'] = '<label for="' . $id . '">' . $el['label'] . '</label>'; } else { $el['label'] = "<label>{$el['label']}</label>"; } } // Display-only (frozen) elements if (!empty($el['frozen'])) { if ($element->getAttribute('data-api-entity') && $element->getAttribute('data-entity-value')) { $this->renderFrozenEntityRef($el, $element); } $el['html'] = '<span class="crm-frozen-field">' . $el['html'] . '</span>'; } else { if ($element->getType() == 'select' && $element->getAttribute('data-option-edit-path')) { $this->addOptionsEditLink($el, $element); } if ($element->getType() == 'group' && $element->getAttribute('allowClear')) { $this->appendUnselectButton($el, $element); } } return $el; }
/** * Creates an array representing an element containing. * the key for storing this. We allow the parent to do most of the * work, but then we add some CiviCRM specific enhancements to * make the html compliant with our css etc * * * @param HTML_QuickForm_element $element * @param bool $required * Whether an element is required. * @param string $error * Error associated with the element. * * @return array */ public function _elementToArray(&$element, $required, $error) { self::updateAttributes($element, $required, $error); $el = parent::_elementToArray($element, $required, $error); // add label html if (!empty($el['label'])) { $id = $element->getAttribute('id'); if (!empty($id)) { $el['label'] = '<label for="' . $id . '">' . $el['label'] . '</label>'; } else { $el['label'] = "<label>{$el['label']}</label>"; } } // Display-only (frozen) elements if (!empty($el['frozen'])) { if ($element->getAttribute('data-api-entity') && $element->getAttribute('data-entity-value')) { $this->renderFrozenEntityRef($el, $element); } elseif ($element->getAttribute('type') == 'text' && $element->getAttribute('formatType')) { list($date, $time) = CRM_Utils_Date::setDateDefaults($element->getValue(), $element->getAttribute('formatType'), $element->getAttribute('format'), $element->getAttribute('timeformat')); $date .= $element->getAttribute('timeformat') ? " {$time}" : ''; $el['html'] = $date . '<input type="hidden" value="' . $element->getValue() . '" name="' . $element->getAttribute('name') . '">'; } // Render html for wysiwyg textareas if ($el['type'] == 'textarea' && isset($element->_attributes['class']) && strstr($element->_attributes['class'], 'wysiwyg')) { $el['html'] = '<span class="crm-frozen-field">' . $el['value'] . '</span>'; } else { $el['html'] = '<span class="crm-frozen-field">' . $el['html'] . '</span>'; } } else { if ($element->getType() == 'select' && $element->getAttribute('data-option-edit-path')) { $this->addOptionsEditLink($el, $element); } if ($element->getType() == 'group' && $element->getAttribute('allowClear')) { $this->appendUnselectButton($el, $element); } } return $el; }