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.

eZ debug

Timing: Jan 18 2025 05:21:38
Script start
Timing: Jan 18 2025 05:21:38
Module start 'layout'
Timing: Jan 18 2025 05:21:38
Module start 'content'
Timing: Jan 18 2025 05:21:39
Module end 'content'
Timing: Jan 18 2025 05:21:39
Script end

Main resources:

Total runtime0.6766 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7891152.6094
Module start 'layout' 0.00600.0032 740.398439.4063
Module start 'content' 0.00920.6660 779.8047629.1484
Module end 'content' 0.67520.0014 1,408.953116.2031
Script end 0.6766  1,425.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5044160.0002
Check MTime0.00140.2014160.0001
Mysql Total
Database connection0.00090.127410.0009
Mysqli_queries0.616591.1184720.0086
Looping result0.00070.0979700.0000
Template Total0.648695.920.3243
Template load0.00210.314820.0011
Template processing0.646595.547120.3232
Template load and register function0.00010.018710.0001
states
state_id_array0.00070.108410.0007
state_identifier_array0.00060.090020.0003
Override
Cache load0.00180.2624340.0001
Sytem overhead
Fetch class attribute can translate value0.00080.115030.0003
Fetch class attribute name0.00110.170090.0001
XML
Image XML parsing0.00130.192430.0004
class_abstraction
Instantiating content class attribute0.00000.0036110.0000
General
dbfile0.00100.1447240.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs