Skip to content

Add template events for the news cards and the new layout - #4

Merged
bonelifer merged 1 commit into
mainfrom
template-events
Oct 19, 2026
Merged

bonelifer merged 1 commit into
mainfrom
template-events

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

Adds template events to the news page, so other extensions and styles can add to it without editing NV Newspage. It's template-only: nothing changes on the page until something uses an event.

phpBB's post events in the news cards

Each news card already fired some of phpBB's own viewtopic_body_* events. This adds the rest that fit, in the same places as in phpBB's viewtopic_body.html. An extension that adds something to forum posts (a thanks button, a badge, share links) now usually shows it on the news page too.

  • viewtopic_body_post_subject_before
  • viewtopic_body_post_buttons_list_before / _after
  • viewtopic_body_postrow_rank_before / _after
  • viewtopic_body_postrow_content_before / _after
  • viewtopic_body_postrow_signature_before / _after
  • viewtopic_body_postrow_back2top_before / _prepend / _append / _after

For the back-to-top hooks, the arrow now sits in a back2top block as in phpBB, still at the end of the footer line.

phpBB's contact-menu and Who is online events aren't added, because the news page has neither.

New events for the refreshed layout

  • phpbbmodders_newspage_byline_append: at the end of the byline.
  • phpbbmodders_newspage_active_filters_append: at the end of the "Showing" line, for an extra filter chip.
  • phpbbmodders_newspage_lead_image_before / _after: around the lead image, only when one is shown.
  • phpbbmodders_newspage_footer_prepend / _append: at the start and end of the footer line; _append sits before the back-to-top arrow, for share or like links.
  • phpbbmodders_newspage_single_before / _after: on a single news item, above the "All news" link and after the item, for things like related news.

They use the phpbbmodders_newspage prefix. The original events keep their nickvergessen names, so styles and listeners written for them keep working.

docs/events.md is rewritten as two tables (news page, each news item) listing every event in page order, with where it fires and when it doesn't. The old copy still listed the contact-menu events, which the layout refresh in #3 removed.

Testing

Claude made a throwaway extension that fills all 41 template events with a marker, and counted the markers on seed-forum boards with phpBB 3.3.19 and 4.0.0-a3-dev. The pages were the news list (5 items), a list filtered by forum (3 items) and a single news item. Every event fired where and as often as docs/events.md says, on both boards:

  • the per-item events once per news item;
  • the lead-image events only on items with an image;
  • the filter events only on the lists;
  • the active-filter event only on the filtered list;
  • the single-item events and the subject event only where documented;
  • the post-button events only for the admin, who has buttons.

The test extension was removed afterwards. The back-to-top arrow still sits at the right end of a one-line footer. Unit tests (165, on 3.3.x and master) and template_a11y.py pass.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

🤖 Generated with Claude Code

phpBB's own post events that fit the news card are now fired in the same
places as in viewtopic: before the subject, around the post buttons
list, the rank, the text and the signature, and around the back-to-top
arrow. New events cover the parts the refreshed layout added: the end of
the byline and of the "Showing" line, around the lead image, the start
and end of the footer line, and before and after a single news item.
docs/events.md lists every event with where it fires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bonelifer
bonelifer merged commit a252107 into main Oct 19, 2026
57 checks passed
@bonelifer
bonelifer deleted the template-events branch October 19, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant