omeka-s
omeka-s copied to clipboard
Add arguments to the PageTitle helper to provide control over the CSS classes in the output markup
The PageTitle
helper currently takes four arguments:
- The text of the page title
- The header level to be used in the output
- Optional text for a subhead label
- Optional text for an action label
The helper returns a string based on the arguments:
if ($subheadLabel) {
$subhead = '<span class="subhead">' . $view->escapeHtml($subheadLabel) . '</span>';
}
if ($actionLabel) {
$action = '<span class="action">' . $view->escapeHtml($actionLabel) . '</span>';
}
$level = (int) $level;
if ($level > 0) {
return "<h$level>" . $subhead . '<span class="title">' . $view->escapeHtml($title) . '</span>' . $action . "</h$level>";
}
(Although if the header level is specified as 0
, then only the title text is displayed, with no surrounding markup.)
This code includes the hard-coded CSS classes subhead
, action
, and title
. Theme and module authors may need control over these classes. This could be accomplished by adding three additional arguments after the current arguments.
I'm working on producing code for this.
That's a lot of arguments to add, even though they're optional.
I wonder what you'd think about having this use a partial (which the theme could override) instead?
A partial sounds ideal. I'll go make that now.