From d0def9492e3dce996ee0e7537ba599635b9ab3ce Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 7 Mar 2014 10:05:43 -0500 Subject: [PATCH] CRM_Core_Form addSelect tweaks --- CRM/Core/Form.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index c16d15d2d1..fbf539fc2e 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -904,6 +904,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * - field (field name - only needed if different from name used on the form) * - option_url - path to edit this option list - usually retrieved automatically - set to NULL to disable link * - placeholder - set to NULL to disable + * - multiple - bool * @param bool $required * @throws CRM_Core_Exception * @return HTML_QuickForm_Element @@ -915,6 +916,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (!isset($props['field'])) { $props['field'] = strrpos($name, '[') ? rtrim(substr($name, 1 + strrpos($name, '[')), ']') : $name; } + $props['multiple'] = !empty($props['multiple']) ? 'multiple' : NULL; $info = civicrm_api3($props['entity'], 'getoptions', array( 'field' => $props['field'], 'options' => array('metadata' => array('fields')) @@ -924,7 +926,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (!array_key_exists('placeholder', $props)) { $props['placeholder'] = $required ? ts('- select -') : ts('- none -'); } - if ($props['placeholder'] !== NULL && empty($props['multiple'])) { + if ($props['placeholder'] !== NULL && !$props['multiple']) { $options = array('' => '') + $options; } // Handle custom field -- 2.25.1