Displaying single node field with multiple values

PedroKTFC's picture

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.)


If they are all in the body

xtfer's picture

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

PedroKTFC's picture

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

xtfer's picture

You can't split multivalue fields into separate fields in Display Suite, hence my original response.

When you create a field with

geoff's picture

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 class="field-item odd" property="content:encoded">
            <p>text 2</p>
        <div class="field-item even" property="content:encoded">
            <p>text 3</p>

so then it should be just a case of adding some CSS
.field-item {

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

xtfer's picture

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.