Opened 4 months ago

Last modified 4 months ago

#35636 closed New feature

differentiate placeholder and content provider blocks — at Initial Version

Reported by: Yingjie Lan Owned by:
Component: Template system Version: 5.0
Severity: Normal Keywords: template block
Cc: Yingjie Lan Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The block is a core feature in the template system. Currently, the syntax provides no explicit grammar to differentiate between a placeholder block and a content provider block. In this ticket, an optional and fully backward compatible syntax is proposed to mark a block as a content provider. This new syntax enhances readability, and imposes little effort to implement, and opens the door to allow multiple occurrences of the same block in a single template being given different contents on different conditions (this feature has been requested many times over the years).

Here is the proposed syntax illustrated with an example:

{% block usertools = %} here are my user tools. {% endblock %}

Note the equal sign in the end of the block opening mark, which is an optional element added here to indicate that this is not a placeholder, but a content provider for the block named 'usertools' defined somewhere else.

If this syntax is implemented, the multiple occurrence of such content providers in a single template file can be allowed in the future if deemed desirable.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top