Processing Container Rule Options

Table of Contents

Method: getFormDefaults
Method: getEditorData
Method: process
Displaying Container Rule Options to the User

When a user adds your container rule to their web site, the first thing they will need to do is select options for the rule. This includes things such as selecting a display template or deciding how many rows to show (if applicable).

While the processing of some of these options is handled by Recite CMS, any custom options you require must be processed by your driver. To this end, there are three methods available to you.

In addition to these methods, you must also define a display template for the container rule options.

To demonstrate processing a container rule's options we'll create a container rule driver that asks the user to select a location.

Method: getFormDefaults

  • public function getFormDefaults()

  • Returns array

This method returns an array of values that are stored with any container rule that uses this driver. If a value isn't mentioned here it will not be stored. The array must have the value name as its key and the default value as the value in the array.

Example 3.1. An example of the getFormDefaults() method

    class Driver_containers_rule_weather_controller extends Module_Containers_Driver_Abstract
        // ...
        public function getFormDefaults()
            return array(
                'location' => 'Adelaide'
        // ...