Support

Account

Home Forums Gutenberg Your site doesn’t include support for the block…after plugin update

Solved

Your site doesn’t include support for the block…after plugin update

  • Hey folks,
    we experience issues with a custom button block after updating from ACF Pro 5.9.2 to 5.9.4.

    This notice displays in the block editor for every custom acf block already present.
    It works when adding another acf custom button block to the editor, though.

    we also noticed that acf_register_block() was replaced by acf_register_block_type() it seems.

    This is the code for adding the block

    
    		acf_register_block_type(array(
    			'name'							=> 'acf-button',
    			'title'							=> __('Button', 'ZitrusWPBulma-Child'),
    			'description'				=> __('A custom block to display a configurable button.', 'ZitrusWPBulma-Child'),
    			'render_template'		=> 'parts/blocks/button.php',
    			'category'					=> 'layout',
    			'icon'							=> 'button',
    			'keywords'					=> array( 'button', 'schaltfläche' ),
    			//'mode'							=> 'preview'
    		));
    

    This is the template:

    
    <?php
    /**
     * Block Name: Button
     * 
     * displays a configurable button in theme style
     * 
     */
    
    $mode = get_field('mode');
    $button = get_field('button');
    
    if( $mode === 'link' AND ! $button ) {
    	return;
    }
    
    $modal_settings = get_field('modal-settings');
    if( $mode === 'modal' AND ! $modal_settings ) {
    	return;
    }
    
    $modal_target = ($mode === 'modal') ? 'data-target=' . $modal_settings['target-id'] : '';
    $button_target = ($button AND $button['target'] === '_blank') ? 'target="_blank" rel="noopener"' : '';
    $href = ($button AND isset($button['url'])) ? 'href="'.esc_url($button['url']).'"' : '';
    $label = ($button AND $button['title']) ? $button['title'] : (($modal_settings AND isset($modal_settings['title'])) ? $modal_settings['title'] : '');
    
    $style = get_field('style');
    $size = get_field('size');
    $alignment = get_field('alignment');
    $disabled = false;
    if( $style == 'is-disabled' ) {
    	$disabled = true;
    	$modal_target = '';
    	$href = 'javascript:void();';
    }
    ?>
    
    <div class="acf-button-wrapper <?= esc_attr($alignment) ?>">
    	<a class="acf-button button <?= esc_attr($style) ?> <?= esc_attr($size) ?><?= ($mode === 'modal' AND !$disabled) ? ' modal-button' : '' ?>" <?= ($disabled) ? 'disabled' : ''; ?> <?= $href ?> <?= $button_target ?> <?= $modal_target ?>>
    		<span><?= esc_html($label) ?></span>
    	</a>
    </div>
    

    Any ideas? Thank you!

  • This has been reported recently in at least 2 other topics. You can contact the developer here https://www.advancedcustomfields.com/contact/

  • okay,
    I created a new ticket.

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

You must be logged in to reply to this topic.