From: Tim Mallezie Date: Mon, 23 Mar 2015 07:00:26 +0000 (+0100) Subject: Placeholder is only used for select elements. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2f32ed100a003b0e171c8cbc4d54601afbe584b3;p=civicrm-core.git Placeholder is only used for select elements. --- diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 1b0f8b3010..ecb87b2ad3 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1152,10 +1152,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $label = isset($props['label']) ? $props['label'] : $fieldSpec['title']; - if (!array_key_exists('placeholder', $props)) { - $props['placeholder'] = $required ? ts('- select -') : CRM_Utils_Array::value('context', $props) == 'search' ? ts('- any -') : ts('- none -'); - } - $widget = isset($props['type']) ? $props['type'] : $fieldSpec['html']['type']; if ($widget == 'TextArea' && CRM_Utils_Array::value('context', $props) == 'search') { @@ -1175,7 +1171,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { ))); if ($isSelect) { - // Fetch options from the api unless passed explicitly + // Fetch options from the api unless passed explicitly. if (isset($props['options'])) { $options = $props['options']; } @@ -1183,6 +1179,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $info = civicrm_api3($props['entity'], 'getoptions', $props); $options = $info['values']; } + + // The placeholder is only used for select-elements. + if (!array_key_exists('placeholder', $props)) { + $props['placeholder'] = $required ? ts('- select -') : CRM_Utils_Array::value('context', $props) == 'search' ? ts('- any -') : ts('- none -'); + } + if (CRM_Utils_Array::value('context', $props) == 'search' || ($widget !== 'AdvMulti-Select' && strpos($widget, 'Select') !== FALSE)) { $widget = 'Select'; }