1

I am using Drupal 7 with wysiwyg (7.x-2.0)module and CK editor 3.5.3.6655. I added an image in a block with link and the CK editor code is

<p>
    <a class="thickbox" href="example.com"> [[{"type":"media","view_mode":"media_original","fid":"751","attributes":{"alt":"contact","class":"media-image","typeof":"foaf:Image"}}]]</a>
</p>

But Drupal is adding some divs around the img tag and the resulting code is

<div id="block-block-11" class="block block-block">   
      <div class="content">
         <p>
            <a class="thickbox" href="example.com">
                <div class="field field-name-file field-type-file field-label-hidden">
                    <div class="field-items">
                        <div class="field-item even">
                            <span id="styles-0-0" class="styles file-styles original">
                                <img typeof="foaf:Image" src="path to image.jpg" alt="contact" />
                            </span>
                        </div>
                    </div>
                </div>
            </a>
         </p>
      </div>
    </div>

Then I got the W3C error document type does not allow element "div" here; missing one of "button", "map", "object", "ins", "del", "noscript" start-tag as div is not allowed inside p and a. How can I solve this?

I added div instead of p but no use.

0

2 Answers 2

1

This is a field themeing issue. The field.tpl.php API docs and linked source is a good place to start. The comments on that page also have useful information for you.

2
  • Hill,are you talking about the fields in content-type ? I have this issue with adding full html content with some images into <structure->block-> Block add > Nov 11, 2011 at 5:40
  • The divs were added by the image module and the problem solved when a I updated the module Oct 3, 2012 at 12:46
0

The divs were added by the image module and the problem solved when I updated the module.

When adding an image through media file selector, click on image properties and remove the style sheet class value (media-image attr_typeof_foaf:Image img_fid_106 img__view_mode__media_original). This will show the image in img tag instead of some weird code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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