How to block AddtoAny with this module?

Created on 15 March 2021, over 3 years ago
Updated 2 March 2023, over 1 year ago

I have this module working great for videos - thank you! But how do I block the AddtoAny buttons? I'm not a coder so if the answer involves using the API an example would be great.
I'm using this module together with the EU Cookie Compliance module.

💬 Support request
Status

Closed: works as designed

Version

1.7

Component

User interface

Created by

🇬🇧United Kingdom deadbox

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands steven buteneers

    Hi,

    The add to any module provides a block rendering these buttons, one of the options is to override the block class with your own class by implementing hook_block_alter() and overriding the class definition:

    $definitions['addtoany_block']['class'] = MyAddToAnyBlock::class;
    

    In your own class you can then add the required pre-render callback and custom options for the blocker element:

    public function build(): array {
     $build['#pre_render'][] = 'cookie_content_blocker.element.processor:processElement';
     $build['#cookie_content_blocker'] = [...];
    }
    
Production build 0.71.5 2024