Problem/Motivation

The rendered item processor generates a rendered representation of the entity.
However it does it using the admin theme if indexing is done from

  • node edit form (index on save)
  • search api UI (index now)

Proposed resolution

Switch to the default theme before rendering and then switch back.

Remaining tasks

Review

User interface changes

No

API changes

No

Data model changes

No

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Status: Active » Needs review
StatusFileSize
new3.92 KB

damn D8 is frickin nice

Status: Needs review » Needs work

The last submitted patch, 2: 2732881-rendered-item.patch, failed testing.

The last submitted patch, 2: 2732881-rendered-item.patch, failed testing.

larowlan’s picture

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

Now with tests

larowlan’s picture

Title: 'Rendered item' processor renders in the admin theme if indexing is done either on node edit of from the Search API UI » 'Rendered item' processor renders in the admin theme if indexing is done either on node edit or from the Search API UI

fix typo
better engrish++

Status: Needs review » Needs work

The last submitted patch, 5: 2732881-rendered-item.patch, failed testing.

The last submitted patch, 5: 2732881-rendered-item.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new5.23 KB

doh, do you even --relative @larowlan

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Oh wow, that does look very easy, thanks!

drunken monkey’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.66 KB
new6.65 KB

Great job, thanks a lot!
It looks so easy when someone knows what they're doing …

This needed a re-roll, though. Also, while it's awesome that you included proper DI, we normally also add getters that automatically default to using \Drupal for the injected properties. At least for consistency's sake.

Finally: is there maybe an easy way to verify in the tests that the theme is indeed being switched? Either through the output or by trying to catch the code at some point while it's in the other theme? That would of course be great to avoid regressions later.
But we can also skip it if it's too much trouble.

In any case, again, thanks a lot!

drunken monkey’s picture

Re-roll, plus a tests-only patch to see whether the existing test doesn't suffice after all. (The comment suggests as much, at least.)

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Awesome!
Thanks also, Joris, for reviewing!

Committed.

Thanks a lot again, Lee, for providing the solution!

Status: Fixed » Closed (fixed)

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