omeka-s icon indicating copy to clipboard operation
omeka-s copied to clipboard

Add arguments to the PageTitle helper to provide control over the CSS classes in the output markup

Open DanielFlaum opened this issue 2 years ago • 3 comments

The PageTitle helper currently takes four arguments:

  1. The text of the page title
  2. The header level to be used in the output
  3. Optional text for a subhead label
  4. 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.

DanielFlaum avatar Mar 12 '22 03:03 DanielFlaum

I'm working on producing code for this.

DanielFlaum avatar Mar 12 '22 03:03 DanielFlaum

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?

zerocrates avatar Mar 14 '22 19:03 zerocrates

A partial sounds ideal. I'll go make that now.

DanielFlaum avatar Mar 14 '22 19:03 DanielFlaum