Support

Account

Home Forums Gutenberg Custom Block with flexible content fields not working

Unread

Custom Block with flexible content fields not working

  • Can’t seem to get flexible content to work in ACF Blocks Gutenberg. The block and fields appear on edit. But do not draw on the editor or preview page. The page seems to get caught in a loop and times out. I have other custom ACF blocks working fine but flexible content is causing issues.

    I have ACF fields registered:
    > notice_type, type: flexible content
    > Important, type Layout
    > notice_important, type text
    > Show this field group if block is equal to : notices

    Registered block: register_block_type( get_template_directory() . ‘/acf-blocks/notices’ );

    Block json is:
    {
    “name”: “acf/notices”,
    “title”: “Notices”,
    “description”: “callouts alerts and buttons”,
    “style”: [ “file:../../css/style.css” ],
    “category”: “campus-blocks”,
    “icon”: “chart-line”,
    “keywords”: [“notice”, “notes alerts warnings info”],
    “acf”: {
    “mode”: “auto”,
    “renderTemplate”: “notices.php”
    },
    “supports”: {
    “anchor”: false
    }
    }

    Notices.php:
    <div class=”row”>
    <div class=”col-12 col-lg-12 col-xl-6 page-content”>
    <div class=”notice”>
    <?php
    if ( have_rows( ‘notice_type’ ) ) {
    while ( have_rows( ‘notice_type’ ) ) {
    if ( get_row_layout() == ‘important’ ) {
    the_sub_field(‘notice_important’);
    }
    }
    };
    ?>
    </div>
    </div>
    </div>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.