I was having difficulty getting this module to work with a Search-API-based view, and after some digging, discovered this is due to the REST Views module only supporting Views Entity Fields. I moved the EntityFieldExport logic into a trait so that it may be reused to extend other types of Views Fields, such as Search API Content Datasource Fields in this case. I added a child module so that support for these fields may be optionally enabled. Patch to follow.

Comments

balbuf created an issue. See original summary.

balbuf’s picture

StatusFileSize
new7.67 KB

Patch for the functionality described in the issue description. This was rolled against 1.0.0-alpha9, but it should work fine against 1.0.0-alpha10 as well.

balbuf’s picture

StatusFileSize
new0 bytes

Fixed patch! There was a namespace issue in the original.

balbuf’s picture

StatusFileSize
new7.56 KB

I'm not sure how I uploaded an empty file last time, but here is the actual fixed patch. Oy vey!

cburschka’s picture

Version: 8.x-1.0-alpha9 » 2.0.x-dev
Status: Active » Needs review
StatusFileSize
new3.16 KB

The trait refactor is an interesting idea, but since those methods are overrides I don't think we can/should do that. Referring to parent:: inside a trait will at the very least violate code standards, and there is no clean pattern to get around it.

::renderItems() could possibly be extracted to a trait, but that'd still require adding abstract methods / getters for all methods and properties used by it (->renderer, ->multiple, ->prepareItemsByDelta()), and wouldn't reduce tech debt.

All in all, without multiple inheritance in PHP, I suspect duplicating the code ends up being the lesser evil there.

  • cburschka committed 52b19a6 on 2.0.x
    Issue #3015382 by balbuf: Add support for Search API Content Datasource
    
cburschka’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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