This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Content object attribute id

Content object attribute id

Content object attribute id

Monday 13 June 2011 7:26:03 pm - 3 replies

I need in a custom template function (so in PHP and not in the template) to access the currently displayed content object (I actually need the attribute id of one of its attributes).

Also, I need to access the attribute id of its parent node's attribute and the attribute id of a object selected by object id.

How can I do this?


Modified on Monday 13 June 2011 7:26:51 pm by Sao Tavi

Monday 13 June 2011 10:28:50 pm

You can use the attribute() method like this:


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.


would in PHP be:


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


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.

Thursday 16 June 2011 6:03:38 pm

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?

Monday 20 June 2011 3:02:15 pm

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 big-smile.gif Emoticon


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

36 542 Users on board!

Forums menu

Proudly Developed with from