XF 2.1 Where are XF:functions?

frm

Well-known member
It'd be nice to learn PHP and either edit a core xf:syntax function or copy it and rename it. I know this is more to eat than I can handle now, but, could you point me in the right direction of let's say editing how <xf:hint> or <xf:options> works? Is each syntax a different file or are they in the same file and which one?

Thank you!
 
No. You can't add any custom tags to the template engine, whether they're based on core tags or something you create from scratch.
 
Still seems like you could extend them or outright edit them to not completely break them though...
 
Do you mean by editing the core files? The templater compiler isn't extendable by traditional means to prevent people from causing unrepairable damage to their installations. If you explain what effect you're trying to achieve, there's probably a sane way to do it. You can add custom template functions for example, since those are evaluated at run-time instead of compile-time.
 
Do you mean by editing the core files? The templater compiler isn't extendable by traditional means to prevent people from causing unrepairable damage to their installations. If you explain what effect you're trying to achieve, there's probably a sane way to do it. You can add custom template functions for example, since those are evaluated at run-time instead of compile-time.
Trying to either stick the id next to the title or as a hover tool tip in custom thread fields, et al. with add ons that have custom fields as there is overlap with titles but ids are unique and it'd be a timesaver to see the id rather than guess and check.

20191202_082333.webp
 
Trying to either stick the id next to the title or as a hover tool tip in custom thread fields, et al. with add ons that have custom fields as there is overlap with titles but ids are unique and it'd be a timesaver to see the id rather than guess and check.
The form/option tags are compiled down to functions on the templater, which are called at run-time and extendable. You could extend \XF\Template\Templater::formCheckBox() to add the name attribute to the checkbox label, but this is a bit of a blunt-force instrument and would effect every checkbox across your entire installation, which is probably not what you want.

If you only wanted this to affect custom field inputs, you could use template modifications to simply pass the ID as part of the label for the inputs. If you could create custom template tags, you'd have to use template modifications there anyways. A less tedious option might be extending \XF\Entity\ThreadField with a custom title getter that appends the field ID within the admin app only.
 
Back
Top Bottom