Path

7x / documentation / ez publish / technical manual / 3.6 / reference / modules / content / fetch functions / can_instantiate_class_list


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.

can_instantiate_class_list

Summary

Fetches the classes that the current user can create objects of.

Usage

fetch( 'content', 'can_instantiate_class_list', hash( [ 'group_id',    group_id    ],
                                                      [ 'parent_node', parent_node ] )

Parameters

NameTypeDescriptionRequired
group_id integer The ID number of a class group to fetch classes from. No.
parent_node object Alternative parent node. No.

Returns

Array of ezcontentclass objects or FALSE.

Description

This function fetches a list of classes that the current user is allowed to create objects from. If no parameters are given, the class list will be generated based on the current node and classes from all class groups. The "group_id" parameter can be used to instruct the system to only fetch classes from a certain class group. The "parent_node" parameter can be used to instruct the system to check which classes the current user is allowed to instantiate below a certain node instead of the current node. The function returns an array of ezcontentclass objects or FALSE / empty array if the current user can not create instances of any class.

Examples

Example 1

{def $classes=fetch( 'content', 'can_instantiate_class_list' )}
 
{foreach $classes as $class}
    {$class.name} <br />
{/foreach}

Outputs the name of all classes that the current user is allowed to create below the current node.

Example 2

{def $classes=fetch( 'content', 'can_instantiate_class_list', hash( 'group_id', 3 )}
 
{foreach $classes as $class}
    {$class.name} <br />
{/foreach}

Outputs the name of classes belonging to class group number 3 that the current user is allowed to create below the current node.

Balazs Halasy (06/02/2004 12:01 pm)

Balazs Halasy (29/04/2005 8:21 am)


Comments

  • filter_type

    You can also use the filter_type parameter, which defines the type of filtering. It can be 'exclude' or 'include' (default).