EDS: Get the item's page count - #5523
Conversation
|
|
||
| /** | ||
| * Get year of containing record. | ||
| * Get the start page of the item that contains this record. |
There was a problem hiding this comment.
Unrelated, just a fix.
| 'BibRecord/BibEntity/PhysicalDescription/Pagination/PageCount' | ||
| )[0] ?? null) { | ||
| return $pageCount; | ||
| } elseif ($pageCount = $this->getItem('Name', 'Pages')) { |
There was a problem hiding this comment.
As usual the API repsonses are a bit of a mystery, so I don't know why the page count sometimes comes in via the BibRecord.../Pagination section like start page, and why it's sometimes in the Items data. I assume the answer is "vendor data 🤷 " but @cwolfebsco can you shed any light?
Unfortunately because our EDS templates will display any data that comes from Items, this means that record pages will sometimes display page count and sometimes won't, depending on which field has it. I have a set of configs in my RecordDataFormatter/EDS.ini to hide it from Items and display it via this new method. I don't know if it's generalizable enough to upstream though, even commented out.
[Defaults]
core[] = 'Page Count'
result-list[] = 'Page Count'
[Field_Page Count]
dataMethod = 'getPageCount'
# No thought yet into this positioning
pos = 300
[CoreItems]
...
extraLineOptions[] = 'CorePageCount'
; Need to disable Page Count here from EDS [Items] block
; because we need to load it with getPageCount (above) to cover
; both ways the field can show up from the API.
[CorePageCount]
lineIdentifierKey = 'Name'
lineIdentifierValue = 'Pages'
enabled = false
There was a problem hiding this comment.
@maccabeelevine "vendor data" sounds about right, I am afraid :( Our teams try to match the available data the best they can. While a great benefit to have the original record searched, this is one of the unfortunate side effect.
The page count is sometimes part of the
srcitem data, i.e. the last element ofBut in some dense contexts like the combined search, you may just want to display the page count.