Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

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 8:29 am)

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


Comments

There are no comments.