Docs: Upgrading from 1.19

Upgrading from 1.19

A checklist for a theme forked on Tilspire 1.19.x, up to 1.20.0: three habits that now cost something, the parts that stay hidden until you place them, and the Template API call to use for each.

Tilspire 1.20.0 is additive: a theme that changes nothing keeps working. Three habits now cost something, and a few parts stay hidden until you place them. If your theme was forked earlier than 1.19.0, read the 1.18 notes and the older ones as well; each release lists only what changed since the one below it.

Three habits that now cost something #

  • It draws the comment thread itself. items now holds the first top comments, each followed by its first replies. A top comment may also carry more_replies and more_replies_link. A list that ignores them gives readers no way to reach the later replies.
  • It compares a page's path with home. The owner may now show another page at /, or a module's landing. Ask $this->isHome() instead.
  • It keeps a copy of views/view-ticket.php or components/ticket-form.php. The copy prints tickets.portal.attach_hint, which keeps its old text and still says 5 MB. The real limit now comes from the reader's role. Print $portal['attach_hint'] instead, or delete the copy.

What stays hidden until you place it #

These break nothing.

  • The notifications bell. Core only draws it where your header places it. Without it, members still reach their notifications from the account page.
  • Report, on anything you draw yourself. Core's comments component and the Forums post part already show it, so a theme that uses them gets Report without any change. A comment list or a Forums post part of your own shows nothing until it asks for it.
  • Reactions on a page. Core does not draw them for you. A views/dynamic-page.php of your own calls $this->pageReactionsBlock() where the bar belongs.
  • Reactions in the tracker. tracker-item now also gets reactions and reactions_inert. A view of your own hands each row to core's reactions component.
  • The appearance switch in the footer. The System / Light / Dark switch belongs to the default theme, and an earlier fork does not gain it. You may copy it; the theme guide describes how it works.

Checklist #

Work down it once, search your theme's folder for each pattern, and change what you find.

  1. Comment threads. In your own comment list, put a top comment's replies in an <ol class="cms-comments__replies"> inside its <li data-comment-id="<id>">. End that list with "Show more replies" when both addresses are set, so that it works without JavaScript too:
    <li data-comment-more-replies="<more_replies>"><a href="<more_replies_link>">...</a></li>
    A views/comments-replies.php of your own answers with those <li>s alone: no header, footer or page-container. Or delete your list and use the comments component.
  2. Home. Search for home. Replace each comparison with a page's path with isHome().
  3. Upload hints. Search for attach_hint. In your own views/view-ticket.php and components/ticket-form.php, replace t('tickets.portal.attach_hint') with $portal['attach_hint'] ?? '', and keep escaping it.
  4. The bell. Read visitor() at the top of your header, before <head> prints its stylesheets, so core loads the bell's stylesheet. Then place the bell beside the account menu:
    <?php $this->component('notification-bell'); ?>
    Core's stylesheet prints after yours, so restyle it through your header: .site-header .ntf, not a bare .ntf.
  5. Report. In your own comment list or post part, draw core's part. It draws nothing when this reader is not offered Report, and it loads its own files. The rule behind it is core's, so add none of your own.
    <?php $this->component('report', ['report' => $this->report('comments.comment', (int) $item['id']), 'noun' => 'comment']); ?>
    <?php $this->component('report', ['report' => $this->report('forums.post', (int) $post['post_id'])]); ?>
    For a reader without JavaScript, print reportNotice()['message'] near the top of the page when reportNotice() is not null. It says once what their report came to. It is already escaped, so print it as it is.
  6. Forums actions. In your own post part, place $this->action('forums.post.solution', $post) on a question's replies. forums.post.quote now reads Reply, so change any text of your own that calls it Quote. forums.post.permalink still works, although the default theme no longer shows it.
  7. Sticky header. If your header stays on screen as the page scrolls, set --cms-sticky-top to its height, so that the account page's side menu stops under it. If it scrolls away, leave it unset.
  8. Red actions. Set --cms-danger if core's red does not suit your colours. It is used for an action that leaves or destroys, such as Sign out, and must be readable on --cms-surface in both colour modes.
  9. Bottom sheets. A sheet your theme draws should behave like core's. It slides up as it opens and down as it closes, however it is closed, and nothing moves for a reader who asks for reduced motion. It has a grip that drags it down and an X at its top right, named with t('sheet.close'). A sheet that shows on screens wider than 768 px names its own media rule in data-sheet-media.
  10. Version. Raise version in theme.json on every shipped change.
  11. Check. Load the site as a guest and as a signed-in member. Open a long comment thread, a page with reactions on, and a ticket form. Choose another home page and load it. Then check the Health page for warnings about your theme.

New in 1.20.0 #

These are additive, and each is optional.

  • Notifications. notifications() gives the signed-in member's own notifications, newest first. visitor() gains notifications_url, notifications_on, notifications_unread and notifications_label.
  • Follow. Core's member-profile view draws the Follow button. A view of your own posts user and do=follow or unfollow with csrfField() to /account/follow.
  • Scripts. emojiWords() gives the emoji picker's words in the page's language. dateLocale() gives the locale a script formats this page's times with.
  • Tooltips and core's files. useTooltips() loads core's public tooltip for data-tooltip elements; call it before <head>. coreAsset() gives the address of a core file your theme loads itself, as a theme's copy of a core component does.
  • Forums colours. The quote card, the question badge, the focus ring and the reaction sheet's backdrop take --fx-quote, --fx-quote-alt, --fx-quote-edge, --fx-question-bg, --fx-question-ink, --fx-ring, --fx-ring-offset and --reactions-scrim. Each has a fallback.

More is on these pages: comments on Search, comments and previews; pageReactionsBlock on Other pages and menus; action on Actions and sections; and the tracker calls on Tracker. The theme guide, site/themes/README.md, in every copy of Tilspire, describes every 1.20.0 call, under "Upgrading an older theme" and in the Template API's tables.

New in 1.20.2 #

  • Posts can carry custom fields: read them with field(), rows() and hasField() on the post's own page, or ask posts() for them with its fields option. See Posts.
  • pages() items carry option_values, author and sort, a relation in fields gives page ids, and sort => 'sort' lists in the order the site owner set. See Other pages and menus.
  • A page or post can be hidden from lists. Every list call leaves it out; nothing in your theme needs to change.
  • Neither shipped theme needed a change.