Bootstrap\View\Helper\BootstrapPanelHelper::create PHP Метод

create() публичный Метод

Create a Twitter Bootstrap like panel.
public create ( array | string $title = null, array $options = [] )
$title array | string If array, works as $options, otherwize used as the panel title.
$options array Options for the main div of the panel. Extra options (useless if $title not specified) : - no-body: Do not open the body after the create (default false)
    public function create($title = null, $options = [])
    {
        if (is_array($title)) {
            $options = $title;
            $title = null;
        }
        $options += ['no-body' => false, 'type' => 'default', 'collapsible' => $this->config('collapsible'), 'open' => !$this->_groupInGroup, 'panel-count' => $this->_panelCount];
        $nobody = $options['no-body'];
        $type = $options['type'];
        $open = $options['open'];
        $this->_collapsible = $options['collapsible'];
        $panelCount = $options['panel-count'];
        unset($options['no-body'], $options['collapsible'], $options['type'], $options['open'], $options['panel-count']);
        $options = $this->addClass($options, ['panel', 'panel-' . $type]);
        if ($this->_collapsible) {
            $this->_headId = 'heading-' . $panelCount;
            $this->_bodyId = 'collapse-' . $panelCount;
            $this->_panelCount = intval($panelCount) + 1;
            if ($open) {
                $this->_groupPanelOpen = $this->_bodyId;
            }
        }
        $out = '';
        if ($this->_autoCloseOnCreate && !$this->_lastPanelClosed) {
            $out .= $this->end();
        }
        $this->_lastPanelClosed = false;
        /* Increment panel counter for the current group. */
        $this->_groupPanelCount++;
        $out .= $this->Html->tag('div', null, $options);
        if (is_string($title) && $title) {
            $out .= $this->_createHeader($title, ['title' => isset($options['title']) ? $options['title'] : true]);
            if (!$nobody) {
                $out .= $this->_createBody();
            }
        }
        return $out;
    }