Page Attribute Display Block custom template to output unordered list (w/ Select attribute type)
To me this seems like something that would be VERY commonplace. Not only that, but the view file is simple
So I'm wondering if anyone has already done it.
I can see the attributes themselves are output by just the one line
and I see that it outputs the data as each item as a new line.
So a little php magic to put it back into an array, and then loop through and output it as needed...
getAttribute can be found in src/page/collection/collection.php and has some nice remarks.
* $displayMode makes it possible to get the correct output * value. When you need the raw attribute value or object, use * this: * <code> * $c = Page::getCurrentPage(); * $attributeValue = $c->getAttribute('attribute_handle'); * </code>
Now let's take a look at the select attribute...there is no value.php but the controller has a getValue, which calls getSelectedOptions().
This will return an OptionList object...that you can use in your view.php. (see \concrete\attribute\select\optionlist)
have fun :D