Skip to content

Commit

Permalink
Merge pull request #307 from eileenmcnaughton/master
Browse files Browse the repository at this point in the history
Add hack to support buttonrama without change to code adding submit
  • Loading branch information
seamuslee001 authored Sep 30, 2020
2 parents 0b57736 + 98aa741 commit 13af4d5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion HTML/QuickForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,26 @@ function &addElement($element)
$elementObject->onQuickFormEvent('updateValue', null, $this);
} else {
$args = func_get_args();
$elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1));
if ($element === 'submit') {
// Hack to support https://github.com/civicrm/civicrm-core/pull/18410
// This can maybe get deprecation notices at some point.
$button = explode('_', $args[1]);
$type = array_pop($button);
$attrs = array_merge([
'name' => $args[2],
'type' => 'submit',
'class' => '',
], $args[3]);
$attrs['class'] .= " crm-button crm-button-type-{$type} crm-button{$args[1]}";
$buttonContents = CRM_Core_Page::crmIcon('fa-check-circle') . ' ' . $args[2];
$elementObjects = &$this->createElement('xbutton', $args[1], $buttonContents, $attrs);
$this->setDefaultAction($args[1]);
$group = $this->addGroup([$elementObjects], $args[1], '', ['     '], FALSE);
return $group;
}
else {
$elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1));
}
if (PEAR::isError($elementObject)) {
return $elementObject;
}
Expand Down

0 comments on commit 13af4d5

Please sign in to comment.