Forums / Developer / How to get the selection attribute name

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

How to get the selection attribute name

Author Message

Romeo Antony

Wednesday 29 September 2010 2:43:37 am

I have extended atricle class by a selection attribute with (single selection)

How do I fetch the name of the selection attribute in template

{$node.object.datamap.selection_attribute_identifier. **** what will be here ************ }

When I fetch the reurn array I can get only the array values 0,1,2,3,

How can I get the Value name instead of 0,1,2,3,?

Please help

Matthieu Sévère

Wednesday 29 September 2010 2:54:54 am

Hi Romeo,

You'll need to fetch the content class attribute and then fetch the name matching your IDs 0,1,2,3 ..

See there to get the class matching your current object : http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Objects/ezcontentobjecttreenode

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 3:14:06 am

Thanks for the reply.

that means do I need to code some conditions like if the value of array is 0 then print a name
if valuse is 2 then print next name

i have got an alternative solution by

{attribute_view_gui attribute=$valid_nodes[0].object.data_map.selection attribute}

Matthieu Sévère

Wednesday 29 September 2010 3:25:11 am

Your alternative solution is the good one. It calls the template content/datatype/view/ezselection.tpl you should have a look at this template to understand the mechanism

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 4:16:49 am

ya. I will try that .

Sorry to bother you again. A small doubt .

I need to display nodes in dynamic block. Only the nodes tthas has a specific selection attribute value will be only fetched. For that any idea what attribute filter should I set in fetch class or do

Can u please give me suggetion.

Matthieu Sévère

Wednesday 29 September 2010 4:27:07 am

"

ya. I will try that .

Sorry to bother you again. A small doubt .

I need to display nodes in dynamic block. Only the nodes tthas has a specific selection attribute value will be only fetched. For that any idea what attribute filter should I set in fetch class or do

Can u please give me suggetion.

"

You need to give the id, like array('your_class/your_attribute','=',1)

--
eZ certified developer: http://ez.no/certification/verify/346216

Romeo Antony

Wednesday 29 September 2010 4:34:31 am

Alright. I got it.

Thanks a lot Matthieu.