Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

eZModule and module results

The module.php arrays, the $Params a view gets, the $Result it returns, and the eZModule methods views use - redirectTo(), redirectToView(), handleError(), isCurrentAction(), actionParameter().

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-8-reference/ezmodule.md

On this page

eZModule and module results

Part 8, reference 13. A module is a folder under modules/ with a module.php and one script (or class) per view. eZModule (lib/ezutils/classes/ezmodule.php) loads it and runs the views. The tutorial is Modules and views; this page is the reference.

module.php

VariableHolds
$Modulearray( 'name' => 'myext' ), optionally 'variable_params' => true
$ViewListone entry per view: 'script', 'params' (ordered parameters), 'unordered_params', 'functions' (policy functions), 'default_navigation_part', 'single_post_actions', 'post_action_parameters', 'ui_context'
$FunctionListthe policy functions of the module, with their limitations

What a view gets

A view script finds $Params:

KeyHolds
$Params['Module']the eZModule object
$Params['<Name>']each ordered parameter named in 'params'
$Params['UserParameters']the (name)/value pairs of the URL (View parameters)

What a view returns

A view sets $Result (or, as a class, returns it from run()):

KeyMeaning
contentthe page body
paththe breadcrumb, a list of array( 'text' => ..., 'url' => ... )
navigation_partthe active top tab in the administration
pagelayoutfalse for no frame, or another pagelayout template
content_infofor content views, information about the node

Details: View results, the path and the pagelayout.

eZModule methods views use

MethodUse
redirectTo( $uri )redirect to an address of the site; return $Module->redirectTo( '/myext/list' );
redirectToView( $viewName = '', $parameters = array(), ... )redirect to another view of the same module
redirect( $moduleName, $viewName, $parameters = array(), ... )redirect to a view of another module
handleError( $errorCode, $errorType = false, $parameters = array(), $userParameters = false )show the kernel's error page; return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
isCurrentAction( $actionName, $view = '' )whether a form button mapped by single_post_actions was pressed
actionParameter( $parameterName, $view = '' ), hasActionParameter( ... )the values mapped by post_action_parameters
currentView(), currentAction( $view = '' )the current view and action
setTitle( $title )the page title

Static helpers: eZModule::exists( $moduleName, ... ) and eZModule::findModule( $moduleName, ... ) find a module by name.

Forms with actions

// module.php
$ViewList['edit'] = array(
    'script' => 'edit.php',
    'params' => array( 'ItemID' ),
    'functions' => array( 'manage' ),
    'single_post_actions' => array( 'StoreButton' => 'Store', 'CancelButton' => 'Cancel' ),
    'post_action_parameters' => array( 'Store' => array( 'Name' => 'Name' ) ),
);
<?php
// edit.php
$Module = $Params['Module'];
if ( $Module->isCurrentAction( 'Cancel' ) )
{
    return $Module->redirectTo( '/myext/list' );
}
if ( $Module->isCurrentAction( 'Store' ) )
{
    $name = trim( (string)$Module->actionParameter( 'Name' ) );
    // validate and store
}

Error codes

eZError (kernel/classes/ezerror.php) holds the codes for handleError(): see Error codes and module results.

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.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x