Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295117

[meta] Improve the DX of drupal_render() and renderable arrays

$
0
0

This is intended to be quite a "high level" issue. Just a way to keep track of the various other meta issues and issues around improving the DX for drupal_render() and the renderable arrays (of doom), broadly categorised by use-case/demographic.

Site builders and contrib developers who want to use the render API in their own projects

Ensuring that the render API is easy to use and understand

These issues reduce the number of easy-to-introduce bugs or "gotchas" that developers building and rendering renderable arrays will encounter. This involves simplifying the API as much as possible and reducing the amount of "special casing" where renderable array properties are treated differently depending on contextual factors and the other properties on a given array.

- #2005970: In renderable arrays, #theme should be assumed from #type if not set and #theme => FALSE should force theme() to be bypassed
- #2012812: if theme() in drupal_render() returns an empty string, drupal_render() will inappropriately try to render children recursively
- #2012818: Setting #theme in a renderable array shouldn't change the way that #markup is treated.
- #1842326: Merge _theme_table_cell() into theme_table
- #1975442: drupal_render() should always return a string.

Keeping documentation up to date

In some places the documentation for the render API is great but in others there are comments and docblocks that are demonstrably inaccurate or out of date. The DX around the render API could be improved greatly by keeping these up to date.

- #2015177: Update documentation around hook_element_info() and drupal_render() to not say #type is limited to the Form API
- #2015187: Remove or update the link that currently points to D6 documentation in hook_element_info()

Improving the experience of extending/processing/altering renderable arrays as they pass through the render API

Between when a renderable array is passed into drupal_render() and a "rendered" string is returned, there are multiple points where the data structure of the array can be intercepted and processed (sanitisation, resolving urls, etc..) and altered (modifying/adding content, etc..). These issues aim to keep that process as flexible and developer friendly as possible.

- #2004286: Defer calls to drupal_get_* functions until printed inside a template.

Reducing the amount of work required to modify rendered strings:
- #2008450: Provide for a drillable variable structure in Twig templates
- #1757550: [meta] Convert core PHPTemplate files and theme functions to Twig
- #1300744: Introduce #type 'links'Assigned to: sun

Changes to theme hooks:
- #2004872: [meta] Theme system architecture changes
- #1886448: Rewrite the theme registry into a proper service

Core contributors wanting to extend or improve the performance of the render API

Ensuring the render API is used in a consistent way within core

These issues are important as they help contributors plan improvements/changes to the render API without having to consider/accomodate a ton of "edge cases" in every decision. It also means that the "emergent behaviour" arising from each decision/patch will be more predictable, making it easier to achieve a stable and useable code base.

- #2006152: [meta] Don't call theme() directly anywhere outside drupal_render()
- #1876712: [meta] Convert all tables in core to new #type 'table'
- #2010672: Rename 'type' variable of theme_mark to 'mark_type'
- #1828536: Rename 'type' variable of theme_item_list() to 'list_type'
- #1843668: Make Breadcrumbs renderableAssigned to: bdragon

Performance optimisations for the render API

These issues have zero or minor impact on the functionality of the render API but will provide provable (profiled), replicable performance improvements.

- #2012800: drupal_render() could be lazier about calling element_children()

Reducing the amount of markup passed through the theme system (which can be expensive):
- #1986116: Improve performance by replacing very small and simple templates and theme function with "Markup Utility Functions"
- #1825090: Remove theme_html_tag() from the theme system
- #2009152: The default behaviour for drupal_render() when theme() is not called could be better at representing HTML as structured data

Extensions/modifications to the "internals" of the render API

These issues are ideas/proposals from core contributors directly modifying the internal behaviour of the render API (and the theme API where it's relevant to the render API as the latter invokes the former). Often these changes make sense in their own right but are blocked or hindered by other issues listed here. These issues may have little or no impact on the way the render API is invoked but improve the implementation nonetheless.

- #1843798: [meta] Refactor Render API to be OO


Viewing all articles
Browse latest Browse all 295117

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>