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

eZ Community » Forums » Developer » Fetch Option Items in Selection with PHP
expandshrink

Fetch Option Items in Selection with PHP

Fetch Option Items in Selection with PHP

Tuesday 21 February 2012 3:33:26 pm - 2 replies

Hello,

I want to fetch the options which I created within a Selection in a class. I want to do this in a PHP class.

I tried eZContentClass::fetchByIdentifier but I didn't get the options.

Any Ideas how I can fetch the options?
Thanks in advance.

Martin

Tuesday 21 February 2012 4:20:09 pm

Hi,

after fetching your classAttribute....

you can fetch option like this:

assuming that $oClassAttribute is your option attribute

if($oClassAttribute&& $oClassAttribute->attribute('data_type_string') == 'ezselection')

//eZSelection :: DATA_TYPE_STRING smile signe appears if i do write properly :p

{

$classContent = $oClassAttribute->attribute('content');

$options = !empty($classContent['options'])? $classContent['options']: array();

}

@see: kernel/classes/datatypes/ezselection/ezselectiontype.php@classAttributeContent

to see how the content is built

 

Does this help

Modified on Tuesday 21 February 2012 4:21:45 pm by Ousmane KANTE

Tuesday 21 February 2012 4:36:52 pm

That was the hint I needed.

Thank you very much!

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from