$page->getAttribute Get only the value, not object for building an array
Get all pages where a certain attribute has value. It's a select attribute, so I don't care what value it is, but I need to know if it has one or not. Then I need to make a menu of these pages, so I plan on building a navigation out of an array, but it needs to be ordered alphabetically, so I was going to dump the object values into an array, and do array_unique sorting on it. The problem is, $page->getAttribute('attribute_handle') grabs the object and not the value of the object, so array_unique doesn't work properly. I've tried accessing the object through normal means, but I'm not having much luck. Here is what the object / array / object looks like:
SelectAttributeTypeOptionList Object ( [options:Concrete5_Model_SelectAttributeTypeOptionList:private] => Array (  => SelectAttributeTypeOption Object ( [error] => [ID] => 49 [value] => Mammography [th] => TextHelper Object ( ) [displayOrder] => 36 [usageCount] => ) ) [error] => )
If you echo this, you just get the value, but if you try and place it in to an array, you get the full object.
Here is my foreach loop:
Any suggestions would be appreciated! :)
Have a look at
It would probably be simpler if you use a page type rather than an attribute.
If you want that all in a page list without needing to write any code, my Uber List addon can do it.
Found it here: