acf-gutenblocks
acf-gutenblocks copied to clipboard
Align and supports in the Block constructor options does nothing
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);
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.