• Resolved htwinam

    (@htwinam)


    Hi

    Is there any way to enable the HTML anchor under Advanced for block types? I know we can do this manually when registering a block without this plugin, but can’t find a way via Extended > Block types?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback. Can you please elaborate on what “HTML Anchor” is in Block Types? I’m not sure to understand your request.

    Thanks!

    Regards.

    Thread Starter htwinam

    (@htwinam)

    Hi

    The HTML anchor appears under the blocks Advanced tab (where you input class names) – usually we can add to ACF blocks via the supports parameter within acf_register_block_type as 'supports' => array('anchor' => true). The anchor is then returned using $block['anchor'] in the template, and we can use it as a page anchor.

    But it doesn’t look like it’s supported by your plugin? If not, is there a way I can hook in to add the anchor support for blocks created through ACF Extended?

    Thanks

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Okay I see, thanks!

    I added it to the Trello Board: https://trello.com/c/o1fqF149/437-dynamic-block-type-add-anchor-setting. The setting will be added in the next patch!

    Regards.

    Thread Starter htwinam

    (@htwinam)

    Great stuff, thanks!

    Could you give me an idea of when the next patch is scheduled, just so I can inform my client when we can implement the features he needs?

    Thanks

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    The next update will be pretty big, so I prefer not give any ETA. But we’re pretty close of it. Just to let you know, you can use the acf/register_block_type_args filter in order to add or override any settings of the the Dynamic Block Type module.

    Here is a code example:

    add_filter('acf/register_block_type_args', 'my_acf_register_block_type_args');
    function my_acf_register_block_type_args($args){
        
        // Target my-block-type
        if($args['name'] !== 'acf/my-block-type')
            return $args;
        
        $args['supports']['anchor'] = true;
        
        return $args;
        
    }
    

    See documentation: https://www.advancedcustomfields.com/resources/acf-register_block_type_args/

    Hope it helps!

    Regards.

    Thread Starter htwinam

    (@htwinam)

    Thanks! Just in case anyone else needs to use this, anchor needs to go in the support array:

    $args['supports'] = array(
    	'anchor' => true
    );

    Thanks for your help!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Oh yeah that’s right. I updated my answer ??

    Regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘HTML Anchor’ is closed to new replies.