Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align and supports in the Block constructor options does nothing #39

Open
thomasjulienalain opened this issue Jun 2, 2020 · 1 comment

Comments

@thomasjulienalain
Copy link

thomasjulienalain commented Jun 2, 2020

Hello !

Adding align and supports options to the Block constructor doesn't work properly.

The only way I found to make it work is to bypass the plugin (which is sad) and use acf/register_block_type_args filter instead to correctely set those 2 settings.

add_filter('acf/register_block_type_args', function($args){

            if ($args['name'] == 'acf/bio') {
                $args['align'] = 'full';
                $args['supports'] = array(
                    'align' => array('full'),
                    'mode' => false,
                    'multiple' => false,
                );
            }

            return $args;
        });

Would it work better by adding this to the acf_gutenblocks/block_settings filter? Don't know if it's the best way.

$settings = apply_filters('acf_gutenblocks/block_settings', [
...
            'align'       => $settings['align'],
            'supports'    => $settings['support'] ?? [],
...
], $this->name);
@codepuncher
Copy link
Member

Hey @thomasjulienalain,

A filter is a great idea for that location. Feel free to put together a PR and we can look to get that merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants