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.
itemsnow holds the first top comments, each followed by its first replies. A top comment may also carrymore_repliesandmore_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.phporcomponents/ticket-form.php. The copy printstickets.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
commentscomponent 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.phpof your own calls$this->pageReactionsBlock()where the bar belongs. - Reactions in the tracker.
tracker-itemnow also getsreactionsandreactions_inert. A view of your own hands each row to core'sreactionscomponent. - 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.
- 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:
A<li data-comment-more-replies="<more_replies>"><a href="<more_replies_link>">...</a></li>views/comments-replies.phpof your own answers with those<li>s alone: no header, footer orpage-container. Or delete your list and use thecommentscomponent. - Home. Search for
home. Replace each comparison with a page's path withisHome(). - Upload hints. Search for
attach_hint. In your ownviews/view-ticket.phpandcomponents/ticket-form.php, replacet('tickets.portal.attach_hint')with$portal['attach_hint'] ?? '', and keep escaping it. - 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:
Core's stylesheet prints after yours, so restyle it through your header:<?php $this->component('notification-bell'); ?>.site-header .ntf, not a bare.ntf. - 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.
For a reader without JavaScript, print<?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'])]); ?>reportNotice()['message']near the top of the page whenreportNotice()is notnull. It says once what their report came to. It is already escaped, so print it as it is. - Forums actions. In your own post part, place
$this->action('forums.post.solution', $post)on a question's replies.forums.post.quotenow reads Reply, so change any text of your own that calls it Quote.forums.post.permalinkstill works, although the default theme no longer shows it. - Sticky header. If your header stays on screen as the page scrolls, set
--cms-sticky-topto its height, so that the account page's side menu stops under it. If it scrolls away, leave it unset. - Red actions. Set
--cms-dangerif 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-surfacein both colour modes. - 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 indata-sheet-media. - Version. Raise
versionintheme.jsonon every shipped change. - 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()gainsnotifications_url,notifications_on,notifications_unreadandnotifications_label. - Follow. Core's
member-profileview draws the Follow button. A view of your own postsuseranddo=followorunfollowwithcsrfField()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 fordata-tooltipelements; 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-offsetand--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()andhasField()on the post's own page, or askposts()for them with itsfieldsoption. See Posts. pages()items carryoption_values,authorandsort, a relation infieldsgives page ids, andsort => '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.