Content object attribute id

Content object attribute id

Monday 13 June 2011 10:26:03 am - 3 replies

Modified on Monday 13 June 2011 10:26:51 am by Sao Tavi

Author Message

Marko Žmak

Monday 13 June 2011 1:28:50 pm

You can use the attribute() method like this:

$object->attribute('id');

You will be able to get all the proprties that you can get in the template. You can also concatenate the attribute operator. For example, this.

$object.main_node.node_id

would in PHP be:

$object->attribute('main_node')->attribute('node_id')

This is valid for all eZP objects. For getting the attributes you need:

$object->attribute('data_map')

And this will give you an associative array of object's attributes, attribute identifiers will be the keys in array.

As for getting the currently displayed content ojbect, it really depens on where you wan't to use this function. Try looking at the docs.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sao Tavi

Thursday 16 June 2011 9:03:38 am

Thank you very much, this got me to the next step.

Now, my problem is: how can I check if the current user has the permission to edit the attribute?

Sao Tavi

Monday 20 June 2011 6:02:15 am

Found, it seems that there is a function, canEdit(), inherited from eZContentObjectTreeNode that does exactly this. I should have looked on the inheritance list before asking the question :D

You must be logged in to post messages in this topic!

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