Page Attribute Display Block custom template to output unordered list (w/ Select attribute type)
Permalink
I'm using the core Page Attribute Display block (in 5.7 of course) to display a SELECT type attribute (so with multiple values), and I want to output as an Unordered List.
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...
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
echo $controller->getContent();
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.
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