module.php reference: views, parameters and functions
This page is for application creators who write module.php files. It lists the keys the kernel reads and what each
does. The reader is lib/ezutils/classes/ezmodule.php (eZModule); kernel modules in kernel/<module>/module.php are
the best examples.
Contents
$Module
$Module = array( 'name' => 'Demo', 'variable_params' => false );| Key | Meaning |
|---|---|
name | the module's display name |
variable_params | true makes each view parameter a variable of its own in the view script, besides $Params |
$ViewList entries
| Key | Meaning |
|---|---|
script | the view file in the module directory |
functions | policy functions the user needs (any of them); checked before the script runs |
params | ordered parameters from the address: /module/view/<p1>/<p2> |
unordered_params | named parameters /(name)/value, mapped to $Params keys: array( 'offset' => 'Offset' ) |
single_post_actions | POST button name to action: array( 'StoreButton' => 'Store' ) |
post_actions | POST variables whose value is the action name |
post_action_parameters | per action, POST variables made available as action parameters |
default_action | the action when no button matched |
default_navigation_part | which admin top menu tab is active (ezcontentnavigationpart, ezsetupnavigationpart ...) |
ui_context | edit, administration, browse ...: tells designs what kind of page it is |
ui_component | the component name for the same purpose |
In the view: $Params['Module']->isCurrentAction( 'Store' ), ->hasActionParameter( 'Title' ),
->actionParameter( 'Title' ).
$FunctionList and limitations
$FunctionList = array();
$FunctionList['read'] = array();
$FunctionList['edit'] = array( 'Section' => $SectionLimitation );A function with an empty array has no limitations: a role either has it or not. A limitation is described as in
kernel/content/module.php:
$SectionLimitation = array(
'name' => 'Section',
'values' => array(),
'class' => 'eZSection',
'function' => 'fetchList',
'parameter' => array( false ) );values lists fixed choices (array( array( 'Name' => 'Self', 'value' => '1' ) )); class, function and
parameter name a static method that returns the choices for the role editor. Your code must apply the limitation
itself (Policy functions and limitations).
Functions appear in Users > Roles > New policy once the module is registered and the caches are cleared.
A complete example
$Module = array( 'name' => 'Demo' );
$ViewList = array();
$ViewList['list'] = array(
'script' => 'list.php',
'functions' => array( 'read' ),
'default_navigation_part' => 'ezcontentnavigationpart',
'params' => array(),
'unordered_params' => array( 'offset' => 'Offset' ) );
$ViewList['edit'] = array(
'script' => 'edit.php',
'functions' => array( 'edit' ),
'ui_context' => 'edit',
'params' => array( 'ItemID' ),
'single_post_actions' => array( 'StoreButton' => 'Store', 'CancelButton' => 'Cancel' ),
'post_action_parameters' => array( 'Store' => array( 'Title' => 'ItemTitle' ) ) );
$FunctionList = array();
$FunctionList['read'] = array();
$FunctionList['edit'] = array();Related pages
- Custom modules and views
- Policy functions and limitations
- Policy function pattern
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.