New template hook: thread_edit_fields_main

Jawsh

Active member
PHPBB has this feature I've been hurting for for years so I'm making it myself.

4BI9fs5.png


See those subtitles? I want those. I can hook a new field into the thread creation form thanks to the hand-dandy hook thread_create_fields_main, but no equivalent hook exists for the edit thread form.

ojdgjg3.png

1F6k0B2.png


thread_create
O4jvu4w.png


thread_edit
Vvke4Af.png


So what I'm going to do is add a thread_edit_fields_main, but if I give this add-on out, it'll require everyone to do the same. That's a real drag. It'd be really great if that hook existed by default; I see no reason why it shouldn't.
 
No, which bit on the screenshot is a "subtitle"?

Don't use template hooks. Use template modifications: Appearance > Template Modifications
Ack, that's a forum description. I took the screenshot in a hurry, but it turns out Topic Descriptions were a popular mod I used. Here's a forum I could find that used it:
gQ0rQ6J.png


The thin text between the bold title and topic statistics is the thread descriptions. I need it for my forum because people tend to make thread titles with descriptions, like "1984 - George Orwell's predictions for modern authoritarian government and mind control", which is really messy. I'd prefer it if topic titles were literally just what the thread was about, and topic descriptions would be concise user generated excerpts.

Don't use template hooks. Use template modifications: Appearance > Template Modifications
Is this specific to this request, or should I be using template modifications to inject HTML every time I need it? The mods I learned from used hooks exclusively, I've never even heard of this feature before.


As as aside, it turns out edit_thread is where that form is from, not edit_thread_title. I thought maybe edit_thread_title was the AJAXified edit button on the thread_list, but that's not the case, so in total there's 4 places for this input field, lol.
 
The thin text between the bold title and topic statistics is the thread descriptions.
That makes more sense ;)

should I be using template modifications to inject HTML every time I need it?
Absolutely. Template modifications were added in XF 1.2 back in 2013. Template hooks have been deprecated since then. We've not yet removed them, but realistically we could if we wanted to. We certainly haven't added any new ones (nor will we be). They certainly won't feature at all in XF 2.0.

To be fair, template hooks are a good introduction into how XF development works, so the tutorials (which are fairly old now) are still useful.
 
Absolutely. Template modifications were added in XF 1.2 back in 2013. Template hooks have been deprecated since then. We've not yet removed them, but realistically we could if we wanted to. We certainly haven't added any new ones (nor will we be). They certainly won't feature at all in XF 2.0.
Okay, these are a lot better than I thought just hearing the name "template modifications". I thought this would automatically inject HTML into templates during installation, but it looks like it's a ephemeral change that only affects the rendered page. Very robust, I do like this.
 
Back
Top Bottom