Skip to content

Commit cb4950a

Browse files
committed
dropdown in append/prepend
1 parent 4fba14b commit cb4950a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/View/Helper/FormHelper.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,18 @@ protected function _getColumnClass($what) {
308308
*/
309309
protected function _wrapInputGroup($addonOrButtons, $type) {
310310
if ($addonOrButtons) {
311-
if (is_string($addonOrButtons)) {
311+
if (is_array($addonOrButtons)) {
312+
$addonOrButtons = implode('', $addonOrButtons);
313+
} else {
312314
$addonOrButtons = $this->_makeIcon($addonOrButtons);
313-
if (!Matching::findTagOrAttribute(
314-
'button', ['type' => 'submit'], $addonOrButtons)) {
315-
$addonOrButtons = $this->formatTemplate('inputGroupText', [
316-
'content' => $addonOrButtons
317-
]);
318-
}
319315
}
320-
else {
321-
$addonOrButtons = implode('', $addonOrButtons);
316+
317+
$isButton = strpos($addonOrButtons, '<button') === 0;
318+
$isDropdown = strpos($addonOrButtons, 'data-toggle="dropdown"');
319+
if (!$isButton && !$isDropdown) {
320+
$addonOrButtons = $this->formatTemplate('inputGroupText', [
321+
'content' => $addonOrButtons
322+
]);
322323
}
323324

324325
$addonOrButtons = $this->formatTemplate('inputGroupAddons', [
@@ -713,7 +714,10 @@ public function dropdownButton($title, array $menu = [], array $options = []) {
713714

714715
$options = $this->addClass($options, 'dropdown-toggle');
715716

716-
return $this->button($title, $options) . $this->Html->dropdown($menu, $ulOptions);
717+
return $this->buttonGroup([
718+
$this->button($title, $options),
719+
$this->Html->dropdown($menu, $ulOptions)
720+
], $bGroupOptions);
717721
}
718722

719723
/**

0 commit comments

Comments
 (0)