2

I'm trying to rewrite the output of a field. I have 4 fields and in the last one, I have rewrite output enabled:

<h2 class="speaker-name">[title]<h2>
<h3><span class="speaker-job-title">[entity_id_3]</span>, <span class="speaker-company">[entity_id_1]</span></h3>
<div class="speaker-body">[entity_id]</div>

The fields that are included in this output have "Exclude from display" checked so that's not a problem.

The problem is that the output turns into this:

<span class="views-field views-field-entity-id-4">
<span class="field-content"/></span>  
<h2 class="speaker-name"><a href="/?q=speaker/mr-speaker">Mr Speaker</a></h2>
<h2></h2>
<h3>
    <span class="speaker-job-title">
        <div class="field field-name-field-job-title field-type-text field-label-hidden">
         <div class="field-items">
         <div class="field-item even">Manager, Hotels</div></div></div></span>, <span class="speaker-company"><div class="field field-name-field-company field-type-text field-label-hidden"><div class="field-items"><div class="field-item even">Hotel Inc.</div></div></div>
    </span>
</h3>
<div class="speaker-body">
<div class="field field-name-body field-type-text-with-summary field-label-hidden">
<div class="field-items"><div property="content:encoded" class="field-item even">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam et libero vel mi fringilla commodo ac ac felis. Proin fringilla tempor diam, ut semper dui vestibulum in. Vestibulum arcu tellus, elementum ac consectetur ac, tincidunt non eros. Nunc tempor ipsum eget erat fringilla tempus ut a enim. Donec posuere luctus mauris id ornare. Fusce at est lorem, et consectetur sapien. Pellentesque ac purus ac augue dignissim aliquet a rutrum turpis.</p>
</div>
</div>
</div>
</div>

The fields that are part of the rewritten output are still wrapped in an HTML wrapper or label wrapper. I have no idea how to remove this and display just the field value.

0

In D6, you would look for the HTML Element, Label HTML Element and Wrapper HTML Element dropdowns in the Style Settings of the fields and set them to none. I am assuming (there I go again) that something similar is there in D7.

  • Yep, already did that, everything is set to None. I'm thinking maybe it's the formatter setting now... – Rudolf Olah Feb 20 '12 at 14:49
0

You can! In the field settings, there is a "Style settings" fieldset that allows you to customize the field's HTML.

  • which field settings? – Rudolf Olah Feb 20 '12 at 14:50
0

I found a workaround, not sure if it's the correct solution...

If you go to all the fields that are being rewritten into another field and click "Strip HTML Tags", it will display properly. I think it strips out the tags around the field just before it's rewritten into the other field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.