Skip to content
Everett Griffiths edited this page Mar 27, 2014 · 10 revisions

These are sample object data structures that you could save in your database/objects/ directory. The files must be named after the object's class name, e.g. modSystemSetting.php. JSON files can also be used. A file can contain a single object or an array of objects.

You can examine the output of the Export function to generate these files for you from existing data. You can also use Repoman's "Look" function to examine object structure along with their relations.

Custom Manager Page (modMenu)

This example is attached to an action, so this is how you would build a Custom Manager Page.

<?php
/**
 * This file must be named modMenu.php and stored in your model/seeds/ directory
 * The menu 'text' and 'description' fields should be Lexicon keys.
 */
return array(
   array(
       'text' => 'moxycart',
       'description' => 'moxycart_desc',
       'parent' => 'components',
       'action' => 0,
       'icon' => '',
       'menuindex' => 0,
       'params' => '',
       'handler' => '',
       'permissions' => '',
       'Action' => array (
           //'action' => 0, // Omit this so that it will inherit from the related object
           // This will create an ERROR: Attempt to set NOT NULL field action to NULL
           // But it's safe to ignore in this case.
           'namespace' => 'moxycart',  // <-- this must match your namespace exactly
           'controller' => 'index',
           'haslayout' => 1,
           'lang_topics' => 'moxycart:default',
           'assets' => '',
           'help_url' =>  '',
       ),
   ),
);
/*EOF*/

modSystemSetting

Name the file modSystemSetting.php:

<?php
/*-----------------------------------------------------------------
For descriptions here, you must create some lexicon entries:
Name: setting_ + $key
Description: setting_ + $key + _desc
-----------------------------------------------------------------*/
return array(
    array(
        'key'  =>     'moxycart.domain',
		'value'=>     '',
		'xtype'=>     'textfield',
		'namespace' => 'moxycart',
		'area' => 'moxycart:default'
    ),
    array(
        'key'  =>     'moxycart.upload_dir',
		'value'=>     '',
		'xtype'=>     'textfield',
		'namespace' => 'moxycart',
		'area' => 'moxycart:default'
    ),
    array(
        'key'  =>     'moxycart.api_key',
		'value'=>     '',
		'xtype'=>     'textfield',
		'namespace' => 'moxycart',
		'area' => 'moxycart:default'
    ),
);
/*EOF*/

modAction

Name the file modAction.php -- this is useful for defining additional controllers that do not appear in the menu.

<?php
/**
 * This action defines a controller that handles querying for a resource's children.
 */
return array (
    //'action' => 0, // Omit this so that it will inherit from the related object
    'namespace' => 'lunchbox',
    'controller' => 'children',
    'haslayout' => 0,
    'lang_topics' => 'lunchbox:default',
    'assets' => '',
    'help_url' =>  '',
)
/*EOF*/

Clone this wiki locally