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:
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.
- 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:
Bookmark this article as there will be more tips to come for Concrete theme and addon developers.