Add prefix/suffix to field expert template. Makes it possible to add a before the field (including the label). And some other theming stuff I don't understand.

Comments

aspilicious’s picture

Status: Needs review » Needs work

Should be hidden on other templates

aspilicious’s picture

And you shouldn't insert html in a description...

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new3.69 KB

Second try

billiaug’s picture

StatusFileSize
new208.06 KB

Depending on the design, we want to add a wrapper around our complete field or just want to add an extra HTML element.
Mostly we can fix design related problems by using the :after or :before pseudo-elements, but in some cases we need more.

For example: we want to add a complete wrapper, add the element with an ".icon-smiley" class and add the "data-artist" attribute.

Before:

<div class="label-above something">foobar</div>
<div class="some-image">
<img typeof="foaf:Image" src="..." width="305" height="165" alt=""></div>

After:

<div class="custom-field-wrapper-class">
<span class="icon-smiley" data-artist="Bieber" ></span>
<div class="label-above">foobar</div>
<div class="some-image">
<img typeof="foaf:Image" src="..." width="305" height="165" alt=""></div>
</div>
aspilicious’s picture

Issue tags: +sprint-nascom-2013

Needs discussion

Angry Dan’s picture

Cross referencing my patch on previous duplicate issue "add prefix and suffix to expert field template" https://drupal.org/files/ds.field-ui.1529730-5.patch as part of the discussion.

aspilicious’s picture

Issue summary: View changes
Status: Needs review » Patch (to be ported)

Fixed, needs porting

froboy’s picture

Status: Patch (to be ported) » Closed (fixed)

This was committed http://cgit.drupalcode.org/ds/commit/?id=f9a2714. There doesn't seem to be any reason to leave the issue open unless I'm missing something.

arh1’s picture

Is there a reason I'm not considering that we're rendering the prefix inside the outer wrapper, and suffix outside of it? That seems problematic as the common use case of wrapping markup around the entire field output won't work as expected.

arh1’s picture

Here's a quick patch to move the prefix outside of the field's outer wrapper, like the suffix, if that's indeed desirable.

aspilicious’s picture

Status: Closed (fixed) » Needs work

There is an issue with the suffix, will have to move that one inside the outer wrapper.

thomas.d’s picture

Added a patch that moved the suffix inside the outer wrapper.

thomas.d’s picture

Status: Needs work » Needs review
aspilicious’s picture

This can potentially break a lot of websites that rely on the current behaviour.
So I'm afraid I can't push this at the moment.