Posted by PedroKTFC on April 18, 2013 at 7:14pm
I have a simple content type with a body text field which I allow to have up to 3 separate values. I then want to use display suite to display 3 equally spaced columns with the three body text values split across the three columns. However, in the manage display form I can only reference the body text field, not each value. Is there a way to do this?
(Ultimately I want to generalise this for when I have any number of values and columns.)
Comments
If they are all in the body
If they are all in the body field, then they aren't three separate values, they are one big value, so you can't split them up.
If you want to reference them separately, create three new fields on your content type and use them instead.
But you can have multiple values
The problem with that approach is that if I want to add another body field to the content type, I have to add a new field. If you take the Basic Page as an example, you can configure the Body field settings to have multiple values (you get an Add more button) and they're editable in their own distinct edit boxes. I've no idea how they're stored in the database but I'm guessing they're some sort of linked list, not in a single field with some sort of separation between them.
Hope I'm being clear.
You can't split multivalue
You can't split multivalue fields into separate fields in Display Suite, hence my original response.
When you create a field with
When you create a field with exactly three value, the output is still wrapped in DIVs. I just grabbed a blank site and set the page body to three values. The output for the field was
<div class="field field-name-body field-type-text-with-summary field-label-hidden">
<div class="field-items">
<div class="field-item even" property="content:encoded">
<p>text 1</p>
</div>
<div class="field-item odd" property="content:encoded">
<p>text 2</p>
</div>
<div class="field-item even" property="content:encoded">
<p>text 3</p>
</div>
</div>
</div>
so then it should be just a case of adding some CSS
<style>
.field-item {
width:33%;
float:left;
}
</style>
Obviously you do want to have to modify the CSS directly - but isn't there a way in DS to drop this in for a node type?
No, DS does not allow you to
No, DS does not allow you to modify CSS, though you can add classes to regions.
Try CSS Injector if you want to do this on the fly.