The Gravstrap Panel shortcode handles the Bootstrap Panel component. Here is a live example:

The panel shortcode, shown above, is defined by the following definition:

[g-panel heading_title="Title"]
Anim pariatur cliche **reprehenderit**, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.

Shortcode parameters

The [bootstrap-collapse] shortcode has some optional parameters:

  • name - defines an unique component name.
  • heading_title - defines the panel heading title.
  • footer_title - defines the panel footer title.
  • type - defines the panel type. Valid values are primary|success|info|warning|danger|default.

Render the panel component using the template

The panel component can also be dynamically filled with data provided by a json file or fetched from a database. You will provide an array similar to the following one:

$panel = array(
    'name' => 'panel1',
    'heading_title' => 'Title',
    //'footer_title' => Footer title,            
    'type' => 'danger',
    'content' => 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.',

$this->grav['twig']->twig_vars['panel'] = $panel;

then in your template you will render the panel as follows:

{% include 'bootstrap/panel.html.twig' with panel %}

Please note that the provide content is raw: it's up to you to provide a formatted one.

Next Post Previous Post