This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation


When developing an addon, you obviously want to use the latest version of c5 to take advantage of the very cutting edge features it will offer you. Fair enough, but what about users stuck with older versions of c5 for whatever reason ?

Well, the first thing to do is to determine what version you want (can) support, using the Choose what c5 version to develop for howto. Once that is done, you'll have to backport your awesome addon to that version, but fear not, as I am experimenting the very same issue, I'll try to guide you to the "how the hell I do that back in 5.4.1".

The test platform

First of all, you must install your test platform, installing a 5.4.1 on a brand new PHP environment can be a bit tricky, since it will fire thousands of warning, whatever your PHP configuration is, so unless you want to use an old version of PHP for testing (which might be a good idea anyway since your users may also be stucked with very old PHP core), here is what you want to do :

in concrete/controllers/install.php modify the first lines into :

if (!defined('E_DEPRECATED')) {
    error_reporting(E_ALL ^ E_NOTICE ^E_STRICT);
} else {
    error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);

then in concrete/startup/debug_logging.php modify accordingly each error_reporting call to exclute E_STRICT :

    if(defined("E_DEPRECATED")) {
        error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^E_STRICT); // E_DEPRECATED required for php 5.3.0 because of depreciated function calls in 3rd party libs (adodb).
    } else {
        error_reporting(E_ALL ^ E_NOTICE ^E_STRICT);
    ini_set('display_errors', 1);
    if(defined("E_DEPRECATED")) {
        error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^E_STRICT);
    } else {
        error_reporting(E_ALL ^ E_NOTICE ^E_STRICT);
    ini_set('display_errors', 0);

Install as usual, there it is !

(Note, if you installed it without modifying the error_reporting beforwise, you can still recover from messages by modifying after the installation and clearing the cache just after the modification is done).

BackPort tricks !

This is a list of the tricks I found, I will extend it as I find them :

Package installation

recent versions of C5 load a few models for you in the Package::install method, that's not the case for older versions, so you have to load them by hand.

Loader::model( 'single_page' );

Dashboard pages

recent versions of c5 will require you to output the panel header and footer, while those functions are not available in older versions. To add retro-compatibility, enclose your call within a method_exists() call :

$dash = Loader::helper( 'concrete/dashboard' );
if ( method_exists( $dash, 'getDashboardPaneHeaderWrapper' ) )
    $dash->getDashboardPanelHeaderWrapper( ... );

and the same for the footer :

if ( method_exists( $dash, 'getDashboardPaneFooterWrapper' ) )

Accessing the Block Object from the BlockView object :

the blockObj property is protected in recent c5 versions, while it is not in older. Recent versions will give you a getBlockObject() accessor though. You can wrap your call with this :

if ( method_exists( $this, 'getBlockObject' ) )
    $block = $this->getBlockObject();
    $block = $this->blockObj;

Don't use BlockController::get($key) to access record !

recent versions of c5 load the content of the block record into the sets, meaning that you can get the values of that record using BlockController::get( 'myKeyValue' ). This does not work on older versions. Luckily, all values are also loaded as keys of the BlockController instance directly, so instead of :

$controller->get( 'myRecordValue' );

use :


You also want to have a look at the BlockController class to make sure you are not overriding anything in the class with your block record value :/

Tool inclusion :

Recent versions of c5 support

Loader::tool( 'name', $vars, 'package_handle');

but here again, this is pretty new, so rely on this instead :

extract( $vars );
include( DIR_PACKAGES . "/package_handle/tools/name.php" );

if you want to isolate vars, you can create a function to prevent local vars to be transmitted.

Loading Conversation