Drop down class list

Author Message

Nicolas Gommenginger

Thursday 14 January 2010 7:59:38 am

Hi,

In the back-office, I would to limit the drop down class list for the creation of a new element functions of the current node.

For exemple, I have a class "articles_root", if the admin goes to this node and would like to create a new article in it, I would like that the drop down class list contains only the class articles.

Thanks.

Nico

Nicolas Pastorino

Thursday 14 January 2010 11:38:11 pm

Hi Nicolas,

The usual way of restricting the list of allowed content classes for creation at a given location in the tree is to use the access control system. The content | create policy accepts such limitations.
But your case seems to be more of a functional use case than a security question, and the method exposed above might not be suitable. A possible solution would be to build this drop down by hand, in the template you are using for this. I would advise to always verify the list you are building against the authorized one, for security reasons. The latter is available in a node template as follows:

$node.object.can_create_class_list

which takes into account the currently logged in user and the context (location, type of object viewed, section number, ...). You could then further filter this variable.

Hope that helps, cheers!

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.