Updating Concrete Themes from Version 8 to Version 9

This tutorial is over a year old and may not apply to your version of Concrete CMS.
Nov 24, 2022

In this tutorial we will go over some common issues run into when making a theme work on Concrete CMS version 9.

Some of these issues are technical, and some are the result of changes in PHP 8 or misconceptions that all new themes must run on Bedrock. This will be a living document that will include more pointers as they are contributed by the community.

Question: Why am I getting errors like "PHP Fatal error: Uncaught Error: Unknown named parameter"?

Answer: In PHP 8 there are some backwards incompatible changes. One of the most common issues is code attempting to access non-existent variables or properties. This used to be possible in PHP 7 without throwing an error, but in PHP 8 it throws an error. You will likely see an error that looks like this:

PHP Fatal error: Uncaught Error: Unknown named parameter

Basically this means you need to find the spot in the code where you are trying to access a variable that doesn't exist and make sure the variable or property exists before you try to interface with it or evaluate it.

A lot of the pain that theme and addon developers run into can be the result of new requirements in PHP 8, so it's a good idea to familiarize yourself with the backwards incompatible changes in PHP 8:

https://www.php.net/manual/en/migration80.incompatible.php

Question: Do I need to build my theme using Bedrock?

Answer: Nope! You do not need to make your theme use Bedrock in order to be Concrete version 9 compatible.

Question: Why is my file picker not working in my block edit interface anymore?

Answer: Some popular addons implemented the file picker in v8 using methods that were migrated in v9, which resulted in some blocks generated with those addons having file picker issues. For instance, the Block Designer, which allows users to make custom blocks, ran into this issue but has since been updated. So you may need to update your own custom addons or reach out to the developer of your favorite addon to update file picker interfaces.

Question: Do I have to update my theme / site to PHP 8?

Answer: Nope, you can run on PHP 7.4 LTS which receives backported security updates.

Question: How can I make tabs work again?

Answer:

Using the tab helper like: $app->make('helper/concrete/ui')->tabs([]); needs following adjustments: * The container with the tab contents needs an additional CSS class tab-content * The tab contents need the additional CSS class tab-pane and the additional attribute role="tabpanel", the active tab needs the additional CSS class active * The item IDs in the initial $helper->tabs() call need to be prefixed with ccm-tab-content- (e.g. old: pane-general, new: ccm-tab-content-pane-general) * If you need to make these changes backward compatible with Concrete version 8: * Add the prefixes only on Concrete version 9 (3rd point) * All other changes do not interfere with c5-8

Additional Tips:

  • Access new Instances through the app container:
    • old: $app->make('helper/xyz', [$ui]);
    • new: $app->make('helper/mesch/user', ['ui' => $ui]); or $app->make('helper/mesch/user', compact(['ui']));
  • Support for tools has been removed

Special thanks to those community members who contributed tips:

1stthomas , linuxoid

Bookmark this article as there will be more tips to come for Concrete theme and addon developers.

Recent Tutorials
Upgrade Concrete versions 9.3.1 and 9.3.2
Sep 10, 2024
By myq.

How to get past a bug in versions 9.3.1 and 9.3.2 that prevents upgrading the Concrete core through the Dashboard

How to use Composer with Marketplace extensions
Aug 22, 2024

Composer can be used to manage third-party extensions from the marketplace

Controlling Google Tag Manager Tags Based on Concrete CMS Edit Toolbar Visibility
Aug 13, 2024

This document provides a step-by-step guide on how to control the firing of Google Tag Manager (GTM) tags based on the visibility of the Concrete CMS edit toolbar. It explains how to create a custom JavaScript variable in GTM to detect whether the edit toolbar is present on a page and how to set up a trigger that ensures GTM tags only fire when the toolbar is not visible. This setup is particularly useful for developers and marketers who want to ensure that tracking and analytics tags are not activated during content editing sessions, thereby preserving the accuracy of data collected.

Upgrading Concrete from 8.5 to 9.x
Jun 21, 2024
By myq.

How to avoid problems upgrading from 8.5 to 9.x

How to change the default date format
May 30, 2024
By myq.

Change the format of the default date

WebOps Tutorial on Running and Upgrading a Concrete CMS Website
May 2, 2024
By myq.

Describes how to deploy, manage, and upgrade a Concrete CMS website

Improvements?

Let us know by posting here.