backdrop-issues icon indicating copy to clipboard operation
backdrop-issues copied to clipboard

[DX] `hook_layout_info()` should be renamed `hook_layout_template_info()`

Open docwilmot opened this issue 1 year ago • 5 comments

Description of the issue

This hook is actually allows you to define a layout template in code, instead of using a "layout" package with { *.info, *.tpl.php , etc } as found in /layouts or core/layouts.

But it sounds like a function that defines Layout info, as in the Layout objects, built from the layout.layout.json files..

I think that function was missed in the great layout/template renaming event.

docwilmot avatar Jun 25 '24 14:06 docwilmot

Agreed -- I have been slowly trying to wrap my mind around the intricacies of the layout system for that Paragraphs project you glanced over and I think this distinction between layouts and templates (and the associated references) derailed me for a little while.

laryn avatar Jun 25 '24 15:06 laryn

I like this cleanup 👍🏼 ...I've left comments in the PR.

I agree that this should be done in a minor release, but perhaps hold off merging anything till right after the next minor release. That should allow us to have a full 4-month cycle to test more things and catch any possible problems/regressions.

klonos avatar Jul 02 '24 00:07 klonos

Should we add this to the 1.29.0 milestone then?

docwilmot avatar Jul 11 '24 21:07 docwilmot

I think that function was missed in the great layout/template renaming event.

@docwilmot How do you feel about potentially renaming flexible template config files? Is that too much? (e.g. something like layout.template.flexible.name.json instead of layout.flexible.name.json)

laryn avatar Aug 17 '24 13:08 laryn

Overall this looks great. A well-done renaming that provides backwards-compatibility. I left a few comments in the PR. I think the current approach doesn't actually populate the backwards-compatible $layout->layout_info and $renderer->layout_info properties.

I'm not sure this would be wise to merge for 1.29.0. Based on @klonos's suggestion I think we would merge this after the 1.29.0 release and include it in 1.30.0.

quicksketch avatar Sep 02 '24 16:09 quicksketch

PR is ready for another round of reviews. PHPCS as usual seems to find a new batch of nits to pick with every push, but I think its good now.

docwilmot avatar Nov 06 '24 21:11 docwilmot

This looks great @docwilmot. I created a change record at https://docs.backdropcms.org/change-records/hook_layout_info-renamed-to-hook_layout_template_info and updated the PR to reference it. I updated all the @since lines to 1.30.0. I think this is ready to go!

quicksketch avatar Nov 10 '24 04:11 quicksketch

Merged into 1.x for 1.30.0. Thank you @docwilmot for disambiguating the overloaded term "layout"! Thank you @klonos and @laryn both for your code reviews!

quicksketch avatar Nov 18 '24 06:11 quicksketch