Getting Started

Table of Contents

Creating Your Driver File
Assigning the Driver to Clients
Controlling the Order of Execution

Each page render hook is a Recite driver that lives in the ./lib/drivers/pages/renderhooks directory.

Creating Your Driver File

The driver file is a PHP class with the filename driver.php which extends from the Module_Pages_RenderHook_Abstract class.

The class in this file must follow standard Recite driver naming conventions. For example, if your driver is called publishrules, your driver.php file would have the path ./lib/drivers/pages/renderhooks/publishrules/driver.php.

In this example, the file would define a single class called Driver_pages_renderhooks_publishrules_driver

The only method you must define is the __toString(), which must return a brief description of what the render hook driver does.

Note

There are other methods you can also define which we'll cover shortly; if you only define the __toString() your driver won't do anything.

Example 2.1. A sample rendering hook (driver.php)

<?php
    class Driver_pages_renderhooks_publishrules_driver extends Module_Pages_RenderHook_Abstract
    {
        public function __toString()
        {
            return 'Enforce page publishing rules';
        }
    }
?>