Duplicating Blocks

It's possible to extend existing blocks using Block Variants when the changes are fairly small. When we want to dramatically change the functionality of a Block it is worth considering duplicating a currently exisiting block and making a new block.

Duplicate the CSS build#

TODO

Duplicate the Block's field#

TODO

Duplicate the Twig#

  1. Find the twig for the block we wish to duplicate in templates/_inc/components/blocks/

  2. Duplicate it with a new file name

  3. Setup the blockVariant code. It may be necessary to replace the blockVariant code already in the new component, if so the following will set up the block with a default variant with a className of style-a

    {# Get a class for this block based on the variant #}
    {% if blockVariant is not defined or blockVariant == '' %}
    {% set className = 'style-a' %}
    {% else %}
    {# Add additional variant setup here when needed #}
    {% endif %}