October CMS 3.4 - Snippets Release

Release Note 35

Version 3.4 of October CMS introduces snippet features and framework upgrade support.

Table of Contents

New and Improved Snippets

This release introduces snippets to the CMS module. Snippets are available by default to the Markdown and Rich Editors in the backend panel. Learn more about Snippets in the documentation.

image

The Pages plugin previously introduced snippet features and has been updated to v2.0 to use the core feature as a drop-in replacement instead. To upgrade, open your composer.json file and replace ^1.5 with ^2.0 for the rainlab/pages-plugin package. For example:

"require": {
    "rainlab/pages-plugin": "^2.0"
},

Laravel 10 Support

From October CMS version 3.4 onwards, provisional support has been added for Laravel 10. This means dual compatibility with Laravel 9 (default) and Laravel 10.

To use Laravel 10, open your composer.json file and replace ^9.0 with ^10.0 for the laravel/framework package. For example:

"require": {
    "php": "^8.0.2",
    "october/all": "^3.4",
    "october/rain": "^3.4",
    "laravel/framework": "^10.0"
},

Once complete, run the composer update command to request the latest vendor packages.

Introducing Hot Controls

Hot Controls solve a common problem when updating the page using AJAX. You can register a control once and the AJAX framework continuously monitors the DOM for changes. If the control is found, it will initialize automatically. Likewise, when the control is removed, it will run disposal logic.

oc.registerControl('hello', class extends oc.ControlBase {
    connect() {
        // Element has appeared in DOM
    }

    disconnect() {
        // Element was removed from DOM
    }
});

The control is identified using the data-control attribute.

<div data-control="hello"></div>

See the Hot Controls documentation for more details.

Multisite Role Restrictions

The Manage Sites settings page now includes the ability to restrict visible sites based on the administrator role. This allows you to use dedicated administrator roles to manage a specific sites.

To enable the multisite role restrictions feature:

  1. Navigate to Manage Sites and select a site definition
  2. Place check in the Define administrator roles checkbox.
  3. Select the roles allowed to view the site.
  4. Click Save.

When enabled, the site will only be visible in the backend panel to administrators that are specified in the field. For example, to create a site that is only accessible to Developers, select the Developer role in the field.

Password Expiration Policy

A new password policy has been introduced that allows setting a password expiration date. When a password expires, the user must change their password to a new one. The feature is disabled by default, except when an invitation email has been sent.

To enable the feature to force administrators to change their passwords after a specific time, set the expire_days in config/backend.php to a number (in days). If a user has not updated their password within these days, they will prompted to do so before accessing any backend page.

The following configuration forces an administrator to change their password once every 180 days.

'password_policy' => [
    'expire_days' => 180
]

Additionally, when a user is invited to the backend by email, they will need to walk through a process of setting up a new password by logging in first, resetting their password and then logging in a second time using the new password. This feature is enabled by default and cannot be disabled for security best practices.

Code can force an administrator to update their password by setting the is_password_expired column to true in the database.

$user->is_password_expired = true;
$user->save();

Section Component Improvements

The Section component included with Tailor now has property names that are shorter and more meaningful. The following table shows the old and new property names side by side. The old property names are still accepted and will be converted to the new property name when saved via the Editor.

Old Property New Property Description
entryColumn identifier the key name used to find a record (Eg: id, slug, fullslug)
entrySlug value the value to find a record (Eg: 7, my-blog-post, my-category/my-blog-post)
entryDefault isDefault flag the page as default to use when previewing the entry

The value property is now optional, and will default to the same identifier name in the URL code. In the following example, the identifier named id is used and defaults to the :id URL parameter name.

url = "/post/:id"

[section post]
handle = "Blog\Post"
identifier = "id"

See the Section component documentation to learn more.

Notable Minor Changes

New Meta Twig Tag

A {% meta %} Twig tag has been included in this release to compliment the {% styles %} and {% scripts %} tags. The tag is commonly defined in the HEAD section of a page or layout, before the styles and scripts. Documentation for this has been included in the placeholder tag article.

Importing Tailor Globals

The class Tailor\Models\EntryRecordImport has been renamed to Tailor\Models\RecordImport, although both classes are available to avoid a breaking change. This means global blueprints can be imported using the new generic model instead. The class will automatically detect if the supplied blueprint UUID is a global or an entry.

Duplicate Bulk Action for Tailor

Tailor records can be duplicated from the main list by selecting existing records from the list view and clicking on the Duplicate action from the toolbar. This helps to make creating new content faster and easier.

Option Presets

Most form fields, list columns and filter scopes have options definitions. A new property has been added that can be used to specify preset options, such as icons and locales. View the defining options documentation for more details.

Builder Plugin v2.0

The Builder plugin has been revamped to support October CMS v3, including dark mode, updated specifications, a Tailor import tool, and a new inline code editor.

The new Import tab in the Builder can be used to generate scaffold files using Tailor blueprints as a source. In combination, Tailor and Builder work together to create a super-scaffolding tool that can generate multiple files in one process.

Google Analytics v2.0

The Google Analytics plugin has been updated to include support for Google Analytics 4 tracking and reporting features.

Google will stop processing data for Universal Google Analytics on July 1, 2023. You will need to create a Google Analytics 4 property, upgrade the plugin, and configure it to access the new property. Refer to the plugin documentation for a detailed description of the configuration process.

User Plugin v2.1

The User plugin has been updated to include support for JWT authentication. This makes it easier to handle authentication when working with APIs.

The new checkToken property on the session component will check the header for a valid token and authenticate the user. Likewise, the {{ session.token() }} will return a new token for the current authenticated user. In PHP, these functions are Auth::getBearerToken() and Auth::checkBearerToken(). Refer to the plugin documentation to learn more.


This is the end of the document, you may read the announcement blog post or visit the changelog for more information.

comments powered by Disqus