Skip to the content
Documentation

can_instantiate_class_list

No ratings yet

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

Name Type Description Required
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.

Changed in Exponential 6.0.15

The parameters of fetch( 'content', 'can_instantiate_class_list' ) as kernel/content/function_definition.php of Exponential 6.0.15 defines them (eZContentFunctionCollection::canInstantiateClassList()):

Parameter Change
filter_type Defined in 6.0.15 (type string, required: No., default "include"); this page did not list it.
fetch_id Defined in 6.0.15 (type string, required: No., default false); this page did not list it.
as_object Defined in 6.0.15 (type bool, required: No., default true); this page did not list it.
group_by_class_group Defined in 6.0.15 (type bool, required: No., default false); this page did not list it.

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. filter_type

    Kristof Coomans ·

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

Comments

Add a comment

Comments are read by a moderator before they appear.