Support

Account

Home Forums Gutenberg Is it possible to force a block to be only full width?

Solving

Is it possible to force a block to be only full width?

  • I’ve registered my block using the following align and support options.

    acf_register_block_type(array(
      'align'           => 'full',
      'supports'        => array(
        'align' => array('full'),
      ),
    ));

    When I add the block it appears full with in the editor and the only align option that is visible is “Full” however this can be toggled off and the block changes to default width. If there is only a single alignment option available is there a way to remove the alignment button from the toolbar so it can’t be toggled off?

  • This should fix this:

    acf_register_block_type(array(
      'align'           => 'full',
      'supports'        => array(
        'align'        => array('full'),
       'align'        => false,
      ),
    ));

    you need to add the ‘align’ => false, to hide the alignment icon.

  • I can’t get this to work, have you gotten it? No matter what I try it either doesn’t actually make it full width or it shows the option of None or Full. I don’t want any choice and for it to automatically have data-align=”full” attribute.

  • Looks like the best we can get is to set a default and hope they don’t set it back to None https://github.com/AdvancedCustomFields/acf/issues/278

  • dear JiveDig, your link í reallyt great! thanks

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.