Page MenuHomePhabricator

frame:getParent() should work recursively, not just once
Open, Needs TriagePublic

Description

There are many cases where information about the parameters and the call stack is important, not only for the nearest call. For example, you want to prevent the use of the Infobox template directly in articles. But the module can not get this information.

Usually, the module call is wrapped in a template for more convenient use, and hence it is possible to get a frame only for this template. It is not known whether the template itself is called from an article or something else. A typical cascade of template calls before the module is called is 3-4, and these templates can contain parameters that the module needs to know, or which it is desirable to proxy into the module.

Event Timeline

putnik created this task.Jun 5 2018, 7:22 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 5 2018, 7:22 PM
stjn added a subscriber: stjn.Jun 5 2018, 7:22 PM
SerDIDG added a subscriber: SerDIDG.Jun 5 2018, 7:24 PM
Anomie added a subscriber: Anomie.

One level of getParent() is useful to avoid having {{#invoke:}} used directly while keeping the wrapper template simple by not having it have to manually pass through every parameter. Additional levels seem more likely to be confusing and fragile as the template containing the invoke starts to depends on the context where it is called.

For example, you want to prevent the use of the Infobox template directly in articles. But the module can not get this information.

That doesn't seem like something that is all that useful to enforce via a module, rather than by community convention in the same way we typically avoid putting {{#if:}} directly in articles.

A typical cascade of template calls before the module is called is 3-4, and these templates can contain parameters that the module needs to know, or which it is desirable to proxy into the module.

And if the module starts to depend on those 3-4 levels of parents for parameters, it makes the whole stack dependent on those 3-4 levels existing and maintaining the same parameter names.

Vvjjkkii renamed this task from frame:getParent() should work recursively, not just once to ykbaaaaaaa.Jul 1 2018, 1:06 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from ykbaaaaaaa to frame:getParent() should work recursively, not just once.Jul 1 2018, 8:22 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.