If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Hooks to replace content (or not)

RESOLVED WONTFIX

Status

()

Bugzilla
Extensions
--
enhancement
RESOLVED WONTFIX
6 years ago
6 years ago

People

(Reporter: David Marshall, Unassigned)

Tracking

Details

(Reporter)

Description

6 years ago
It would be awfully nice to have a hook mechanism that replaces certain segments of text. Here's an example of what I want. In reports/keywords.html.tmpl is this text:


[% IF caneditkeywords %]
  <p>
    <a href="editkeywords.cgi">Edit keywords</a>.
  </p>
[% END %]


We want to offer an alternative link to users who cannot edit keywords to a form we have for requesting new keywords. Without a super-clever hook mechanism here, my choices are:

1) edit the default template. This is what I'll probably do, because I'd want to merge any future changes with our local changes.

2) copy the default template to an extension, yuck.

3) add a hook or replace that little block with a hook.

I'd like something like (without any thought to whether this would be good syntax):

[% HOOK bottom_link %]

[% IF caneditkeywords %]
  <p>
    <a href="editkeywords.cgi">Edit keywords</a>.
  </p>
[% END %]
[% END %]

If I supply a bottom_link hook in my extensions, it is used. Otherwise, the content in the HOOK block is used.

This may be highly impractical, but I thought I'd throw it out for discussion.

Comment 1

6 years ago
4) copy the default template into the custom/ directory, and edit the template from here. Much simpler!

IMO, this is undoable with hooks, because you would have to add one for each single piece of text. You want a hook here, and then someone else wants a hook somewhere else. I'm marking this bug as wontfix. This won't prevent the discussion if some developers are interested in this topic.

Note that for such things, you could use hooks defined in global/header.html.tmpl to inject JS + CSS to alter content.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.