<?php use BootstrapPHP\Helpers\Html; use BootstrapPHP\Helpers\View; use BootstrapPHP\Button; if (false) { class view_button { } } /** @var \BootstrapPHP\Button $button */ $_button = clone $button; $icon_white = $_button->getType() === Button::TYPE_DEFAULT || $_button->getType() === Button::TYPE_LINK ? false : true; $_icon = $_button->getIcon() ? Html::getIcon($_button->getIcon(), $icon_white) . ' ' : ''; $_text = $_button->getText(); // Формирование строки атрибутов кнопки $_attribute = "\r\n\t" . Html::getId($_button->attributes) . "\r\n\tclass='\r\n\t\tbtn\r\n\t\t{$_button->getType()}\r\n\t\t{$_button->getSize()}\r\n\t\t{$_button->getWidth()}\r\n\t\t" . ($_button->isEnable() === false ? 'disabled' : '') . "\r\n\t\t" . Html::getClasses($_button->attributes) . "\r\n\t'\r\n\t" . ($_button->isEnable() === false && $_button->getTag() === $_button::TAG_BUTTON ? 'disabled' : '') . "\r\n\t" . ($_button->getToggle() ? 'data-toggle="button"' : '') . "\r\n\t" . ($_button->getTextLoading() ? 'data-loading-text="' . htmlspecialchars($_button->getTextLoading(), \ENT_QUOTES) . '"' : '') . ' ' . Html::getData($_button->attributes); // Оборачиваем текст кнопки в выбранный тэг switch ($_button->getTag()) { case $_button::TAG_BUTTON: $_buffer = '<button type="submit" ' . $_attribute . '>' . $_icon . $_text . '</button>'; break; case $_button::TAG_A: $_buffer = '<a ' . ($_button->getUrl() ? 'href="' . $_button->getUrl() . '" ' : '') . $_attribute . '>' . $_icon . $_text . '</a>'; break; case $_button::TAG_INPUT: $_buffer = '<input type="submit" value="' . $_text . '" ' . $_attribute . '></input>'; break; } // Если нужно оборачиваем кнопку в тэг формы if ($_button->getUrl() and ($_button->getTag() === $_button::TAG_BUTTON or $_button->getTag() === $_button::TAG_INPUT)) {
<?php echo Html::getClasses($_dropdown_menu->attributes); ?> " <?php echo Html::getData($_dropdown_menu->attributes); ?> <?php echo get_class($_dropdown_menu) === get_class(new DropdownMenu()) ? 'role="menu" aria-labelledby="dropdownMenu"' : ''; ?> > <?php foreach ($_dropdown_menu->getItems() as $item) { $disabled = $item->isDisabled() ? 'disabled' : ''; $icon = $item->getIcon() ? Html::getIcon($item->getIcon(), $item->isDisabled()) . ' ' : '<i class="i"></i>'; $text = $item->getText(); $attributes = $item->getAttributes(); $id = ''; $classes = ''; $data = ''; if ($attributes) { $id = Html::getId($attributes); $classes = Html::getClasses($attributes); $data = Html::getData($attributes); } if ($item instanceof BootstrapPHP\LinkDropdownMenuItem) { /** @var BootstrapPHP\LinkDropdownMenuItem $item */ if ($item->getText() === BootstrapPHP\DropdownMenu::DIVIDER) { ?> <li class="divider"></li>
> <?php if ($item instanceof HeaderNavItem) { echo $item->getText(); } else { if ($item->getText() === $_nav::DIVIDER) { echo '<li class="divider"></li>'; } else { ?> <a href="<?php echo $item->getUrl(); ?> "> <?php if ($item->getIcon()) { echo Html::getIcon($item->getIcon()) . ' '; } echo $item->getText(); if ($item->getSubNav()) { echo $item->getSubNav(); } ?> </a> <?php } } ?> </li> <?php } ?>