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.


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
  • 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

Special thanks to those community members who contributed tips:

1stthomas


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

Recent Tutorials
Setting addon/theme version compatibility in the marketplace
Jan 9, 2024

For developers worn out with setting the latest addon or theme version manually across too many core versions, here is a JavaScript bookmarklet to do it for you.

How to get the locale of a page
Jan 8, 2024
By wtfdesign.

Now, why don't we just have a getLocale() method on Page objects beats me, but here's how you work around it

Using a Redis Server
Jun 16, 2023
By mlocati.

How to configure Concrete to use one or more Redis servers to persist the cache.

Using the Concrete Migration Tool Addon
Apr 27, 2023

How to use the Concrete CMS Migration Tool

How To Add Page Last Updated To Your Concrete CMS Pages
Mar 7, 2023

Concrete CMS has a page attribute you can add to a global area called "Page Date Modified." Here's how to add it

How To Exclude Subpages from Navigation
Dec 24, 2022

How to exclude subpages from navigation - useful for a news or blog link in your main navigation where you don't want all the subpages to appear in a drop down menu.

Improvements?

Let us know by posting here.