Problem/Motivation

When excerpt fields are present in a display they have no wrapping tags to target styling.

Steps to reproduce

1. Add an excerpt to a search result display mode
2. Search for a term and observe that there is not wrapping markup to target an excerpt for styling.

Proposed resolution

I suggest we wrap it with something descriptive to target.

Comments

vector_ray created an issue. See original summary.

vector_ray’s picture

How about this?

vector_ray’s picture

Assigned: vector_ray » Unassigned
Status: Active » Needs review
seutje’s picture

Works for me, but I'm not sure if hardcoding the wrapper is the way to go. Is there no way to just run this through the regular field mechanics so you can use a template?

drunken monkey’s picture

Status: Needs review » Needs work

You’re right, that is less than ideal. Thanks a lot for reporting this problem.

However, while I unfortunately know very little about the rendering/theming process in Drupal, I’m with seutje in thinking that hard-coding the wrapper div doesn’t seem like a very “clean” way of fixing this.
Any suggestions for making this “cleaner”, such that, e.g., themes could override the markup? Can/Should we provide a template for this?

seutje’s picture

Status: Needs work » Needs review
StatusFileSize
new1.37 KB

Added a template for it. Not sure about the classes because this could create confusion about the template to override, as it isn't really part of the field API...

seutje’s picture

StatusFileSize
new1.38 KB

Fixed copy/pasta mistake in the template code comments.

drunken monkey’s picture

Thanks a lot! To my non-themer eyes, this looks like a pretty good solution.
Could anyone else affected by this problem (or with more theme layer knowledge) test and review as well?

drunken monkey’s picture

Anyone able to review? Would be good to get feedback here to make sure this is actually an improvement.

marios anagnostopoulos’s picture

Hello there,

I know that lucene backends provide ways to request the results pre-wrapped.
Besides that though, the DB backend (and probably others as well) don't, so that's a nice addition.

With Drupal's theming principles in mind, the patch is sound and it should remove (minor but still) headaches when needing to theme the highlighter results.

All in all, looks good.

drunken monkey’s picture

Status: Needs review » Fixed

Good to hear, thanks a lot for reviewing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.