Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We have three levels of "renderers" in the page build pipeline: RenderHtmlRenderer
, HtmlFragmentRenderer
, and HtmlPageRenderer
. Of course, the first one is a confusing name and works on "render arrays". We use "render" a lot. :-)
Proposed resolution
Come up with a new suffix for the three build pipeline services.
Remaining tasks
Bikeshed on a name, then do it.
User interface changes
None.
API changes
Rename a few services. Nothing major.
Comments
Comment #1
Crell CreditAttribution: Crell commentedComment #2
Crell CreditAttribution: Crell commentedComment #3
Wim LeersFixing typos that hinder legibility.
Comment #4
cosmicdreams CreditAttribution: cosmicdreams commentedI searched all of core for the string "RenderHtmlRenderer" and couldn't find one. Did I miss something, or does that not exist anymore.
Also, HtmlFragmentRenderer and HtmlPageRenderer doesn't exist. But DefaultHtmlFragmentRenderer.php and DefaultHtmlPageRenderer.php exist as well as HtmlFragmentRendererInterface.php and HtmlPageRendererInterface.php.
Let's be clear of what we're talking about here.
Comment #5
Crell CreditAttribution: Crell commentedRenderHtmlRenderer will appear in core as soon as someone gets around to committing #2256365: Factor render->fragment code out to a service.
Comment #6
cosmicdreams CreditAttribution: cosmicdreams commentedRenderer seems like an appropriate name to me. But for the sake of argument here are a few alternatives:
http://www.thesaurus.com/browse/render
Producer
Maker
Deliverer
Interpreter
Performer
Contributor
Provider
also some that weren't included
Hydrator
Builder
Processor
Compiler
I'm assuming you want to keep the er pattern.
Comment #7
joelpittetRender is the action, shouldn't a HtmlPage or HtmlFragment know how to render themselves via a render() method and/or a __toString()?
"View" would be what I'd prefer(bias), but may get confused with Views which seems to be why we call everything "render" or "renderable"
Likely over simplifying things but thought I'd throw it out there, the View that I'm familiar with most is from Kohana which is very similar to an HtmlFragment in that they use HMVC pattern (sub controller calls from within other parts of the system with their own view(fragment) returns like a server side ajax call.
https://github.com/kohana/core/blob/3.4/develop/classes/Kohana/View.php#...
This ends in a beauty like this:
Comment #8
joelpittetIgnore me... I don't know what HtmlPage/Fragment is really doing yet to say anything constructive...
And I can do mostly that View::factory thing with this:
Comment #9
cosmicdreams CreditAttribution: cosmicdreams commentedThis issue might be on the right track; see:
http://objology.blogspot.com/2011/09/one-of-best-bits-of-programming-adv...
Renderer made the list of Objects that tend to have better names.
Should we switch our thinking into having the ability to render be an interface. We could call it Renderable. Then anything that has the Renderable interface could be renderable.
Comment #10
Wim LeersFixed by #2352155: Remove HtmlFragment/HtmlPage.