Object status

Author Message

David Santiso

Saturday 19 March 2011 10:58:20 am

Hi,

I've created a new group object status. How can I check the status of an object from a template?

Thanks,

David

Damien Pobel

Sunday 20 March 2011 4:34:24 am

Hi David,

I guess you are working in a view template so you have the $node object. To get the list of object state identifiers you can write :

{$node.object.state_identifier_array}

or

{$node.object.state_id_array}

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

David Santiso

Sunday 20 March 2011 7:46:21 am

I've showed the contents of that array and are identifiers, but how do I display the name of the state?

Damien Pobel

Sunday 20 March 2011 11:09:21 am

As far as I know, there's no fetch function nor template operator to load an object state from its identifier, but you can write it on your own.

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Marko Žmak

Sunday 20 March 2011 1:10:00 pm

Logically, if the object states names are displayed in the admin interface under object details, then they should be fetchable in templates...

What you are looking for is "allowed_assign_state_list" property, try this:

{$node.object.allowed_assign_state_list|attribute(show)}

To narrow down your search through all thoose properties and arrays, here's an example of what you need:

{$node.object.allowed_assign_state_list[0].group.states[0].current_translation.name}

You'll figure out the rest...

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

Hubert Farnsworth

Marko Žmak

Sunday 20 March 2011 4:10:51 pm

P.S. I think that the documentation for ezcontentobject should be updated.

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

Hubert Farnsworth

David Santiso

Monday 21 March 2011 1:48:42 pm

Thank you very much ;)

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