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

Crell’s picture

Issue tags: +WSCCI
Crell’s picture

Wim Leers’s picture

Issue summary: View changes

Fixing typos that hinder legibility.

cosmicdreams’s picture

I 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.

Crell’s picture

RenderHtmlRenderer will appear in core as soon as someone gets around to committing #2256365: Factor render->fragment code out to a service.

cosmicdreams’s picture

Renderer 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.

joelpittet’s picture

Render 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:

  print View::factory() 
    ->set_filename('template.html.twig')
    ->set(['food' => 'bread', 'beverage' => 'water']); // Data for template.
joelpittet’s picture

Ignore 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:

  print \Drupal::service('twig')->render('template.html.twig', ['food' => 'bread', 'beverage' => 'water']);
cosmicdreams’s picture

This 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.

Wim Leers’s picture

Status: Active » Closed (duplicate)