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

Adds blockVersion & validate settings to cached block.json #300

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

ouun
Copy link
Contributor

@ouun ouun commented Jan 6, 2025

Hi @Log1x,

Happy New Year!

I have a block registered for which I need to set the acf_block_version to 1. Overwriting the settings() method of the class Block like this:

    /**
     * Overwrite the block settings to use ACF Block Version 1.
     * This prevents the inner blocks from being wrapped into a .acf-innerblocks-container div.
     *
     * @return Collection The block settings.
     */
    public function settings(): Collection
    {
        return parent::settings()->put('acf_block_version', 1);
    }

This works perfectly as long as I do not cache the blocks.
This PR adds blockVersion & validate to the cached blocks.json file. Both are settings that might be relevant: https://github.com/AdvancedCustomFields/schemas/blob/7efb0ab78ce903a1414705a83b0fe9b426d5d321/json/block.json#L63

Thanks and kind regards

@ouun
Copy link
Contributor Author

ouun commented Jan 7, 2025

@Log1x please let me know if you prefer to introduce $blockVersion and $validate properties instead of using $this->settings()->get(). Might be more consistant.

@Log1x
Copy link
Owner

Log1x commented Jan 7, 2025

@Log1x please let me know if you prefer to introduce $blockVersion and $validate properties instead of using $this->settings()->get(). Might be more consistant.

Sorry, was AFK yesterday. Let's do props.

@ouun
Copy link
Contributor Author

ouun commented Jan 7, 2025

@Log1x moved to props here, too. Would be great to get that merged, soon. Thanks a lot!

@Log1x Log1x merged commit f4a88d7 into Log1x:master Jan 7, 2025
2 checks passed
@ouun ouun deleted the patch-1 branch January 7, 2025 11:28
@Log1x
Copy link
Owner

Log1x commented Jan 7, 2025

Would be great to get that merged, soon.

Release pushed 👍

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

Successfully merging this pull request may close these issues.

2 participants