Need to insert comma or line break after each page attribute

Permalink
I'm currently in the beginning stages of this project. On the individual facility pages I've added various Page Attributes to be displayed in the sidebar in a templated page. One in particular, Facility Features, is tied to a multi-selection attribute and it needs something to break up the various words whether that's a comma or a line break. How and where would the necessary code go to break this up?

http://www.barkingtuna.com/mlorch/self-storage-locations/south-phoe...

barkingtuna
View Replies: View Best Answer
goodnightfirefly replied on at Permalink Reply
goodnightfirefly
Right now in order to do this we need two files; a custom template for the page_attribute_display block (application/blocks/page_attribute_display/templates/list.php)

<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
$content = $controller->getContent();
foreach ($content->options as $option) {
  $list[] = $option->value;
}
$str = implode(', ', $list);
echo $controller->getOpenTag();
echo "<span class=\"ccm-block-page-attribute-display-title\">".$controller->getTitle()."</span>";
echo $str;
echo $controller->getCloseTag();


and an override of concrete/attributes/select/option_list.php (copy to application/attributes/select/option_list.php), where we change the visibility of
private $options = array();
to
public $options = array();


However, I'm not able to get overrides working yet myself so someone in the know will have to help us. My understanding is that in application/bootstrap/app.php you just add

Core::bind('Concrete\Attribute\Select\OptionList', function() {
  return new \Application\Attribute\Select\OptionList();
});


and it should work, but it doesn't for me.
weyboat replied on at Permalink Best Answer Reply
weyboat
In your css file you have a declaration of
div.ccm-page div.ccm-block-page-attribute-display-wrapper {
  padding-top: 10px;
  padding-bottom: 10px;
}

Try making it like this
div.ccm-page div.ccm-block-page-attribute-display-wrapper {
  padding-top: 10px;
  padding-bottom: 10px;
  white-space: pre-line;
}


EDIT
It looks like you have it as an in-line style in your header
goodnightfirefly replied on at Permalink Reply
goodnightfirefly
That is a really elegant solution, I like it
barkingtuna replied on at Permalink Reply
barkingtuna
Thank you both for equally viable solutions... Always fun to see it attacked from multiple angles. The CSS route was the easiest to accomplish and worked brilliantly. Thanks again for the help.