foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
$fieldId = $dao->id;
$fieldName = 'custom_' . $dao->id;
$customSearchFields[$name] = $fieldName;
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $fieldName, $fieldId, FALSE, FALSE);
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $fieldName, $fieldId, FALSE);
break;
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$elementName = 'custom_' . $field['id'];
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $field['id'],
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $field['id'], FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
}
/**
- * This function for building custom fields.
+ * Add a custom field to an existing form.
*
* @param CRM_Core_Form $qf
* Form object (reference).
* @param string $elementName
* Name of the custom field.
* @param int $fieldId
- * @param bool $inactiveNeeded
- * -deprecated.
* @param bool $useRequired
* True if required else false.
* @param bool $search
* True if used for search else false.
* @param string $label
* Label for custom field.
- *
- * @return HTML_QuickForm_Element|null
+ * @return \HTML_QuickForm_Element|null
+ * @throws \CiviCRM_API3_Exception
*/
public static function addQuickFormElement(
- &$qf,
- $elementName,
- $fieldId,
- $inactiveNeeded = FALSE,
- $useRequired = TRUE,
- $search = FALSE,
- $label = NULL
+ $qf, $elementName, $fieldId, $useRequired = TRUE, $search = FALSE, $label = NULL
) {
$field = self::getFieldObject($fieldId);
$widget = $field->html_type;
$fieldId = $field['id'];
$elementName = $field['element_name'];
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $inactiveNeeded, $required);
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $required);
}
}
}
elseif (substr($fieldName, 0, 6) === 'custom') {
$customFieldID = CRM_Core_BAO_CustomField::getKeyID($fieldName);
if ($customFieldID) {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, FALSE, $required, $search, $title);
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, $required, $search, $title);
}
}
elseif (substr($fieldName, 0, 14) === 'address_custom') {
list($fName, $locTypeId) = CRM_Utils_System::explode('-', $fieldName, 2);
$customFieldID = CRM_Core_BAO_CustomField::getKeyID(substr($fName, 8));
if ($customFieldID) {
- CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, FALSE, $required, $search, $title);
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $name, $customFieldID, $required, $search, $title);
}
}
elseif (in_array($fieldName, array(
// Handle custom fields
if (strpos($name, 'custom_') === 0 && is_numeric($name[7])) {
$fieldId = (int) substr($name, 7);
- return CRM_Core_BAO_CustomField::addQuickFormElement($this, $name, $fieldId, FALSE, $required, $props['context'] == 'search', CRM_Utils_Array::value('label', $props));
+ return CRM_Core_BAO_CustomField::addQuickFormElement($this, $name, $fieldId, $required, $props['context'] == 'search', CRM_Utils_Array::value('label', $props));
}
// Core field - get metadata.
if (is_array($this->_groupTree[$this->_groupId])) {
foreach ($this->_groupTree[$this->_groupId]['fields'] as & $field) {
//add the form elements
- CRM_Core_BAO_CustomField::addQuickFormElement($this, $field['element_name'], $field['id'], FALSE, CRM_Utils_Array::value('is_required', $field));
+ CRM_Core_BAO_CustomField::addQuickFormElement($this, $field['element_name'], $field['id'], CRM_Utils_Array::value('is_required', $field));
}
$this->assign('groupTree', $this->_groupTree);
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
- CRM_Core_BAO_CustomField::addQuickFormElement($form,
- $elementName,
- $fieldId,
- FALSE, FALSE, TRUE
- );
+ CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
}
}
}