Skip to content

[3.0] Theme split (wave 4, part 2) — name the board index's sub templates instead of wrapping them - #9385

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-boardindex-subtemplates
Open

[3.0] Theme split (wave 4, part 2) — name the board index's sub templates instead of wrapping them#9385
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-boardindex-subtemplates

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part of the split of #7933, wave 4 part 2.

The board index is drawn by a template layer whose two halves each call exactly
one function:

function template_boardindex_outer_above()
{
	template_newsfader();
}

function template_boardindex_outer_below()
{
	template_info_center();
}

A layer says that something wraps around the middle of the page. Nothing here
does: the news fader, the board list and the info centre are three things one
after another. Theme::loadSubTemplates() already walks a sub_templates array,
so they can be named directly:

Utils::$context['sub_templates'] = [
	'newsfader',
	'boardindex',
	'info_center',
];

and the layer, along with both forwarding functions, goes.

Testing

The rendered page is byte-for-byte identical, as a guest and as an admin.
index.php fetched on release-3.0 and on this branch, normalised for the
session variable, the security tokens, the cache-busting query strings, the
<time> values and the cron timestamp:

lines result
guest 270 identical
admin 378 identical

The admin capture is a real logged-in session — it contains the logout link, the
mark-all-as-read button and the user menus — so both branches of
template_boardindex() are covered.

Notes for the reviewer

  • template_main() becomes template_boardindex(). It has to have a name to
    be listed. A custom theme that overrides BoardIndex.template.php and provides
    only template_main() will stop being called, so this is worth a line in the
    upgrade notes whenever those get written. Nothing in the repository refers to
    the old name — I checked Sources/, Themes/ and SSI.php — and
    boardindex_outer has no other references either.
  • The class docblock said "and main sub template", which is no longer true, so it
    now names the three.
  • This is deliberately only the structural change. The theme branch also rewrites
    the markup of all three (board_container, board_info, the info centre's
    info_block / info_block_icon split, an avatar in the last-post column) and
    those need their index.css slice with them, so they follow separately.

Issues References (Fixes|Related|Closes)

Related to #7933

The board index was drawn by a template layer whose two halves each called one
function: template_boardindex_outer_above() called template_newsfader(), and
template_boardindex_outer_below() called template_info_center(). A layer says
that something wraps around the middle of the page, which is not what is
happening here. The news fader, the board list and the info centre are three
things one after another.

Theme::loadSubTemplates() already walks a sub_templates array, so the three can
be named directly and the layer and its two forwarding functions go. The board
list is renamed from template_main() to template_boardindex() to be nameable.

Output is unchanged.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
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