Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes JSONLD endpoint fail for Extracted Text #768

Merged
merged 4 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
langcode: en
status: true
dependencies:
config:
- media.type.extracted_text
enforced:
module:
- islandora_text_extraction_defaults
module:
- media
id: media.extracted_text
targetEntityType: media
bundle: extracted_text
types:
- 'pcdm:File'
fieldMappings:
name:
properties:
- 'dcterms:title'
- 'rdf:label'
created:
properties:
- 'schema:dateCreated'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
changed:
properties:
- 'schema:dateModified'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
uid:
properties:
- 'schema:author'
mapping_type: rel
field_mime_type:
properties:
- 'ebucore:hasMimeType'
field_media_of:
properties:
- 'pcdm:fileOf'
mapping_type: rel
field_original_name:
properties:
- 'premis3:originalName'
field_tags:
properties:
- 'schema:additionalType'
mapping_type: rel
field_file_size:
properties:
- 'premis:hasSize'
3 changes: 3 additions & 0 deletions src/Plugin/ContextReaction/JsonldTypeAlterReaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public function execute(EntityInterface $entity = NULL, array &$normalized = NUL

// Search for the entity in the graph.
foreach ($normalized['@graph'] as &$elem) {
if (!is_array($elem['@type'])) {
$elem['@type'] = [$elem['@type']];
}
if ($elem['@id'] === $this->getSubjectUrl($entity)) {
foreach ($entity->get($config['source_field'])->getValue() as $type) {
// If the configured field is using an entity reference,
Expand Down