*
*/
function &add($type, $name, $label = '',
- $attributes = '', $required = FALSE, $javascript = NULL
+ $attributes = '', $required = FALSE, $extra = NULL
) {
- $element = $this->addElement($type, $name, $label, $attributes, $javascript);
+ // Normalize this property
+ if ($type == 'select' && is_array($extra) && !empty($extra['multiple'])) {
+ $extra['multiple'] = 'multiple';
+ }
+ $element = $this->addElement($type, $name, $label, $attributes, $extra);
if (HTML_QuickForm::isError($element)) {
CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
}
$attrs = array_merge($js, $attrs);
}
+ if ($button['type'] === 'cancel') {
+ $attrs['class'] .= ' cancel';
+ }
+
if ($button['type'] === 'reset') {
$prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs);
}
$buttonName = $this->getButtonName($button['type']);
}
- if (in_array($button['type'], array(
- 'next', 'upload')) && $button['name'] === 'Save') {
+ if (in_array($button['type'], array('next', 'upload', 'done')) && $button['name'] === ts('Save')) {
$attrs = array_merge($attrs, (array('accesskey' => 'S')));
}
$prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs);
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'))
if (!array_key_exists('placeholder', $props)) {
$props['placeholder'] = $required ? ts('- select -') : ts('- none -');
}
- if ($props['placeholder'] !== NULL && !$props['multiple']) {
+ if ($props['placeholder'] !== NULL && empty($props['multiple'])) {
$options = array('' => '') + $options;
}
// Handle custom field