This is the old documentation center for eZ Publish 4. We are currently migrating the eZ Publish documentation to http://confluence.ez.no the eZ Publish 5 documentation platform. Documentation for the eZ Publish legacy components are still located on this site, as well as all documentation for earlier releases.

CustomActionMap

Summary

List of custom datatype actions and corresponding module or view or just view in case of content module where they should be executed

Usage

 

CustomActionMap[ActionAddComment]=comment/add

Description

List of custom datatype actions and corresponding <module>/<view> or just <view> in case of content module where they should be executed, eg:

  • CustomActionMap[ActionAddToBasket]=shop/basket
  • CustomActionMap[ActionCollectInformation]=collectinformation

Note: Action definition should be defined in contentActionList function of the datatype, see ez[multi]pricetype.php for code example.

eZ Comments, or any other extension, might want to provide a custom action, in the eZ Comments case the possibility to comment on content. With custom actions you don't get form in form issues, as all actions share one form, thus you can have both information collection, shop and comment actions on the same object. The form goes to content/action which then executes the <module>/<view> you defined in CustomActionMap, if it can't be found you'll get an error.

Examples

Example

extension/ezcomments/settings/datatype.ini:
<code>
#?ini charset="utf-8"?
 
[ViewSettings]
CustomActionMap[ActionAddComment]=comment/add
</code>
 
extension/ezcomments/datatypes/ezcomcomments/ezcomcommentstype.php:
<code>
    /**
     * Return content action(s) which can be performed on object containing
     * the current datatype. Return format is array of arrays with key 'name'
     * and 'action'. 'action' can be mapped to url in datatype.ini
     *
     * @param eZContentClassAttribute $classAttribute
     * @return array
    */
    function contentActionList( $classAttribute )
    {
        $actionList = parent::contentActionList( $classAttribute );
        $actionList[] = array( 'name' => ezpI18n::tr( 'ezcomments/datatype', 'Comment on content' ),
                               'action' => 'ActionAddComment'
        );
        return $actionList;
    }
</code>

Geir Arne Waaler (31/08/2010 10:29 am)

Geir Arne Waaler (08/09/2010 11:31 am)


Comments

There are no comments.