{{!
    @template theme_foundation/block

    Example context (json):
    {
        "id": "inst0",
        "class": "block block_html",
        "showskiplink": true,
        "type": "html",
        "ariarole": "complementary",
        "title": "Test block",
        "blockinstanceid": 1,
        "collapsible": 1,
        "content": "<p>Hello block world!</p>"
    }

}}
{{! Block Skip Link }}
{{#showskiplink}}
    <a href="#sb-{{skipid}}" class="visually-hidden visually-hidden-focusable">{{#str}}skipa, access, {{title}}{{/str}}</a>
{{/showskiplink}}

{{! Start Block Container }}
<section id="{{id}}"
    class="{{class}} card mb-sm-2{{#hidden}} hidden{{/hidden}}{{#hascontrols}} block_with_controls{{/hascontrols}}{{#haswidth}} {{width}}{{/haswidth}}"
    role="{{ariarole}}"
    data-block="{{type}}"
    data-instance-id="{{blockinstanceid}}"
    {{#arialabel}}
        aria-label={{#quote}}{{{arialabel}}}{{/quote}}
    {{/arialabel}}
    {{^arialabel}}
        {{#title}}
            aria-labelledby="instance-{{blockinstanceid}}-header"
        {{/title}}
    {{/arialabel}}>

    {{! Block contents }}
    <div class="card-body">
        {{#collapsible}}
            <div id="instance-{{blockinstanceid}}-action" class="block-action block-collapsible" data-instance-id="{{blockinstanceid}}" title="{{#str}}blockshowhide, theme_foundation{{/str}}"></div>
        {{/collapsible}}
        {{! Block header }}
        {{#title}}
            <h5 id="instance-{{blockinstanceid}}-header" class="card-title d-inline-block">{{{title}}}</h5>
        {{/title}}

        {{#hascontrols}}
            <div class="block-controls header">
                {{{controls}}}
            </div>
        {{/hascontrols}}

        <div class="card-text content">
            {{{content}}}
            <div class="footer">{{{footer}}}</div>
            {{{annotation}}}
        </div>

    </div>

{{! End Block Container }}
</section>

{{! Block Skip Link Target }}
{{#showskiplink}}
    <span id="sb-{{skipid}}"></span>
{{/showskiplink}}

{{#collapsible}}
{{#js}}
require(['theme_foundation/collapseblock'], function (CollapseBlock) {
    CollapseBlock.collapseBlockInit();
});
{{/js}}
{{/collapsible}}