Dont overwrite existing post_type block templates to add the bb-editor choice.
-
Hi,
When I started defining post_type block templates, I noticed that only the BB ‘fl-builder/layout’ block was shown on the post_types that could use BB.
I was confused at first why my templates didn’t work, but when I looked in the code I found that
FLBuilderWPBlocksLayout::init_template()
(inbb-plugin\classes\class-fl-builder-wp-blocks-layout.php
) just fills the template property.$post_type->template = array( array( 'fl-builder/layout' ), );
without checking existing template content. It just removed my template.
It would be nicer to other plugins and themes to not overwrite the entire template to add a single block asking if the bb editor should be used. Can you please merge the templates instead or add it at the front of the template? That would probably prevent some headaches for people that try to use templates themselves.
I understand templates are not that much used at the moment, but since several plugins in my install just overwrite the templates, each of them removes what the other has added. That is not a good best practice, so please reconsider.
Thanks,
Hans
- The topic ‘Dont overwrite existing post_type block templates to add the bb-editor choice.’ is closed to new replies.