diff --git a/npr_api/src/NprClient.php b/npr_api/src/NprClient.php index e47915d..a3f8c44 100644 --- a/npr_api/src/NprClient.php +++ b/npr_api/src/NprClient.php @@ -254,13 +254,16 @@ public function parse() { $current = $xml_iterator->current(); $key = $xml_iterator->key(); - if ($key == 'image' || $key == 'audio' || $key == 'link') { + if ($key == 'image' || $key == 'audio' || $key == 'multimedia' || $key == 'link') { if ($key == 'image') { $parsed->{$key}[] = $this->parseSimplexmlElement($current); } if ($key == 'audio') { $parsed->{$key}[] = $this->parseSimplexmlElement($current); } + if ($key == 'multimedia') { + $parsed->{$key}[] = $this->parseSimplexmlElement($current); + } if ($key == 'link') { $type = $this->getAttribute($current, 'type'); $parsed->{$key}[$type] = $this->parseSimplexmlElement($current); @@ -318,7 +321,20 @@ public function parse() { } } break; - + case 'multimedia': + // Add a placeholder for each referenced image to the body. + // But check to see if the object is multidimensional first. + if (isset($items->num)) { + $body_content[$items->num] = "[npr_multimedia:" . + $items->refId . "]"; + } + else { + foreach ($items as $item) { + $body_content[$item->num] = "[npr_multimedia:" . + $item->refId . "]"; + } + } + break; default: break; } diff --git a/npr_pull/src/NprPullClient.php b/npr_pull/src/NprPullClient.php index 532efc4..655eedf 100644 --- a/npr_pull/src/NprPullClient.php +++ b/npr_pull/src/NprPullClient.php @@ -54,6 +54,13 @@ class NprPullClient extends NprClient { */ protected $additionalImagesField; + /** + * The multimedia field on the story. + * + * @var string + */ + protected $multimediaField; + /** * Create a story node. * @@ -180,7 +187,7 @@ public function addOrUpdateNode($story, $published, $display_messages = FALSE) { // Add a reference to the media audio. $media_audio_ids = $this->addOrUpdateMediaAudio($story); if ($audio_field == 'unused') { - $this->nprError('This story contains audio, but the audio field for NPR stories has not been configured. Please configured it.'); + $this->nprError('This story contains audio, but the audio field for NPR stories has not been configured. Please configure it.'); return; } if (!empty($audio_field) && $audio_field !== 'unused' && !empty($media_audio_ids)) { @@ -188,6 +195,23 @@ public function addOrUpdateNode($story, $published, $display_messages = FALSE) { $this->node->{$audio_field}[] = ['target_id' => $media_audio_id]; } } + + // Make the multimedia field available to other methods. + $this->multimediaField = $story_mappings['multimedia']; + $multimedia_field = $this->multimediaField; + // Add a reference to the media audio. + $media_multimedia_ids = $this->addOrUpdateMediaMultimedia($story); + if ($multimedia_field == 'unused') { + $this->nprError('This story contains multimedia, but the multimedia field for NPR stories has not been configured. Please configure it.'); + return; + } + if (!empty($multimedia_field) && $multimedia_field !== 'unused' && !empty + ($media_multimedia_ids)) { + foreach ($media_multimedia_ids as $media_multimedia_id) { + $this->node->{$multimedia_field}[] = ['target_id' => $media_multimedia_id]; + } + } + // Add data to the remaining fields except image and audio. foreach ($story_mappings as $key => $value) { @@ -210,8 +234,7 @@ public function addOrUpdateNode($story, $published, $display_messages = FALSE) { } elseif ($key == 'body') { // Find any image placeholders. - preg_match_all('(\[npr_image:\d*])', $story->body, - $image_placeholders); + preg_match_all('(\[npr_image:\d*])', $story->body, $image_placeholders); if (!empty($image_placeholders[0])) { // Get the associated tags and replace the @@ -219,6 +242,17 @@ public function addOrUpdateNode($story, $published, $display_messages = FALSE) { $image_replacements = $this->replaceImages($image_placeholders[0]); $story->body = str_replace(array_keys($image_replacements), array_values($image_replacements), $story->body); } + + // Find any multimedia placeholders. + preg_match_all('(\[npr_multimedia:\d*])', $story->body, $multimedia_placeholders); + if (!empty($multimedia_placeholders[0])) { + // Get the associated items and replace the placeholders in the + // body text. + $multimedia_replacements = $this->replaceMultimedia($multimedia_placeholders[0]); + $story->body = str_replace(array_keys($multimedia_replacements), array_values($multimedia_replacements), $story->body); + } + + $this->node->set($value, [ 'value' => $story->body, 'format' => $text_format, @@ -420,6 +454,71 @@ protected function replaceImages(array $images) { return $image_embed; } + /** + * Replace multimedia items in body text. + * + * @param array $multimedia + * An array of multimedia "tokens" in the format [npr_multimedia:xxxx]. + * + * @return array|null + * An array with the "token" as the key and the rendered multimedia item + * as the value, or null. + * + */ + protected function replaceMultimedia(array $multimedia) { + // Get the multimedia field information. + $multimedia_field = $this->multimediaField; + + // Get the multimedia items referenced in the fields. + $referenced_multimedia = $this->node->{$multimedia_field}->referencedEntities(); + + // Get mappings. + $story_config = $this->config->get('npr_story.settings'); + $mappings = $story_config->get('multimedia_field_mappings'); + $multimedia_id_field = $mappings['multimedia_id']; + $url_field = $mappings['remote_multimedia']; + + $multimedia_refs = []; + foreach ($referenced_multimedia as $multimedia_item) { + // Retrieve the npr_id for each item. + if (!empty($multimedia_id_field) && $multimedia_id_field != 'unused') { + $npr_id = $multimedia_item->get($multimedia_id_field)->value; + } + + if (!empty($url_field) && $url_field != 'unused') { + $rendered_multimedia = + $multimedia_item->get($url_field)->view('default'); + $rendered_multimedia = trim(render($rendered_multimedia)->__toString()); + } + + if (isset($npr_id) && isset($rendered_multimedia)) { + // Add rendered multimedia to an array with the NPR ID as the key. + $multimedia_refs[$npr_id] = [ + 'item' => $rendered_multimedia, + ]; + } + + } + + + $multimedia_embed = []; + if (!empty($multimedia_refs)) { + // Loop through the multimedia items in the API response. + foreach ($multimedia as $media_item) { + // Get the NPR refId and use it to retrieve the correct multimedia item + // out of the array. + $ref_id = (int) filter_var($media_item, FILTER_SANITIZE_NUMBER_INT); + if (isset($multimedia_refs[$ref_id])) { + // Build the embedded media tag, using the original "token" as the + // array key. + $multimedia_embed[$media_item] = $multimedia_refs[$ref_id]['item']; + } + } + } + + return $multimedia_embed; + } + /** * Creates a image media item based on the configured field values. * @@ -711,6 +810,110 @@ protected function addOrUpdateMediaAudio($story) { return $audio_ids; } + /** + * Creates a media multimedia item based on the configured field values. + * + * The assumption here is that NPR is sending content suitable for their + * embedded, shareable JW Player. If the response is something else, this + * will likely not work as expected. + * + * @param object $story + * A single NPRMLEntity. + * + * @return array|null + * An array of multimedia media ids or null. + */ + protected function addOrUpdateMediaMultimedia($story) { + + // Skip if there is no multimedia. + if (empty($story->multimedia)) { + return; + } + + // Get and check the configuration. + $story_config = $this->config->get('npr_story.settings'); + $multimedia_media_type = $story_config->get('multimedia_media_type'); + + // Get the entity manager. + $media_manager = $this->entityTypeManager->getStorage('media'); + + // Get, and verify, the necessary configuration. + $mappings = $this->config->get('npr_story.settings')->get('multimedia_field_mappings'); + $multimedia_id_field = $mappings['multimedia_id']; + if ($multimedia_id_field == 'unused' || $mappings['multimedia_title'] == 'unused' || $mappings['remote_multimedia'] == 'unused') { + $this->nprError('Please configure the multimedia_id, multimedia_title, and remote_multimedia settings.'); + return NULL; + } + $remote_multimedia_field = $mappings['remote_multimedia']; + + // Create the multimedia media item(s). + foreach ($story->multimedia as $i => $multimedia) { + if (!empty($multimedia->id)) { + $uri = 'https://www.npr.org/embedded-video'; + $query = [ + 'storyId' => $story->id, + 'mediaId' => $multimedia->id, + ]; + $options = [ + 'query' => $query, + ]; + $multimedia_uri = URL::fromUri($uri, $options)->toString(); + } + else { + return; + } + + // Check to see if a story node already exists in Drupal. + if ($media_multimedia = $media_manager->loadByProperties([$multimedia_id_field => $multimedia->id])) { + if (count($media_multimedia) > 1) { + $this->nprError( + $this->t('More than one multimedia media item with the ID @id ("@title") exists. Please delete the duplicate multimedia media.', [ + '@id' => $multimedia->id, + '@title' => $story->title, + ])); + return; + } + $media_multimedia = reset($media_multimedia); + // Replace the multimedia field. + $media_multimedia->set($remote_multimedia_field, ['uri' => $multimedia_uri]); + $media_multimedia->set('uid', $this->config->get('npr_pull.settings')->get('npr_pull_author')); + // Clear the reference from the story node. + $this->node->set($this->multimediaField, NULL); + + } + else { + // Otherwise, create a new media multimedia entity. Use the title of the + // story for the title of the multimedia. + $media_multimedia = Media::create([ + $mappings['multimedia_title'] => $story->title, + 'bundle' => $multimedia_media_type, + 'uid' => $this->config->get('npr_pull.settings')->get('npr_pull_author'), + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + $remote_multimedia_field => ['uri' => $multimedia_uri], + ]); + } + // Map all of the remaining fields except title and remote_audio. + foreach ($mappings as $key => $value) { + if (!empty($value) && $value !== 'unused' && !in_array($key, ['multimedia_title', 'remote_multimedia'])) { + // ID doesn't have a "value" property. + if ($key == 'multimedia_id') { + $media_multimedia->set($value, $multimedia->id); + } + // "duration" is used by audio in config, so the key name doesn't align + elseif ($key == 'multimedia_duration') { + $media_multimedia->set($value, $multimedia->duration->value); + } + else { + $media_multimedia->set($value, $multimedia->{$key}->value); + } + } + } + $media_multimedia->save(); + $multimedia_ids[] = $media_multimedia->id(); + } + return $multimedia_ids; + } + /** * Extracts an NPR ID from an NPR URL. * diff --git a/npr_story/config/install/npr_story.settings.yml b/npr_story/config/install/npr_story.settings.yml index b063066..83fa377 100644 --- a/npr_story/config/install/npr_story.settings.yml +++ b/npr_story/config/install/npr_story.settings.yml @@ -26,6 +26,7 @@ story_field_mappings: primary_image: field_npr_primary_image additional_images: field_npr_additional_images audio: field_npr_audio + multimedia: field_npr_multimedia externalAsset: field_external_assets body: field_npr_body byline: field_npr_byline @@ -69,6 +70,14 @@ audio_field_mappings: remote_audio: field_media_npr_remote_audio duration: field_npr_audio_duration rightsHolder: field_npr_audio_rights_holder +multimedia_media_type: npr_remote_multimedia +multimedia_field_mappings: + multimedia_id: field_npr_multimedia_id + multimedia_title: name + remote_multimedia: field_media_npr_multimedia + multimedia_duration: field_npr_multimedia_duration + width: field_npr_multimedia_width + height: field_npr_multimedia_height external_asset_media_type: npr_external_asset external_asset_field_mappings: external_asset_title: name diff --git a/npr_story/config/optional/core.entity_form_display.media.npr_remote_multimedia.default.yml b/npr_story/config/optional/core.entity_form_display.media.npr_remote_multimedia.default.yml new file mode 100644 index 0000000..6d97070 --- /dev/null +++ b/npr_story/config/optional/core.entity_form_display.media.npr_remote_multimedia.default.yml @@ -0,0 +1,92 @@ +langcode: en +status: true +dependencies: + config: + - field.field.media.npr_remote_multimedia.field_media_npr_multimedia + - field.field.media.npr_remote_multimedia.field_npr_multimedia_duration + - field.field.media.npr_remote_multimedia.field_npr_multimedia_height + - field.field.media.npr_remote_multimedia.field_npr_multimedia_id + - field.field.media.npr_remote_multimedia.field_npr_multimedia_width + - media.type.npr_remote_multimedia + module: + - link + - path +id: media.npr_remote_multimedia.default +targetEntityType: media +bundle: npr_remote_multimedia +mode: default +content: + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_media_npr_multimedia: + weight: 0 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_npr_multimedia_duration: + weight: 103 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content + field_npr_multimedia_height: + weight: 102 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content + field_npr_multimedia_id: + weight: 104 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content + field_npr_multimedia_width: + weight: 101 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content + name: + type: string_textfield + weight: -5 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + path: + type: path + weight: 30 + region: content + settings: { } + third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 100 + region: content + third_party_settings: { } + uid: + type: entity_reference_autocomplete + weight: 5 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + match_limit: 10 + region: content + third_party_settings: { } +hidden: { } diff --git a/npr_story/config/optional/core.entity_form_display.node.npr_story.default.yml b/npr_story/config/optional/core.entity_form_display.node.npr_story.default.yml index 725b895..6260e30 100644 --- a/npr_story/config/optional/core.entity_form_display.node.npr_story.default.yml +++ b/npr_story/config/optional/core.entity_form_display.node.npr_story.default.yml @@ -2,7 +2,6 @@ langcode: en status: true dependencies: config: - - field.field.node.npr_story.field_external_assets - field.field.node.npr_story.field_npr_additional_images - field.field.node.npr_story.field_npr_artist - field.field.node.npr_story.field_npr_audio @@ -15,6 +14,7 @@ dependencies: - field.field.node.npr_story.field_npr_last_modified - field.field.node.npr_story.field_npr_link - field.field.node.npr_story.field_npr_mini_teaser + - field.field.node.npr_story.field_npr_multimedia - field.field.node.npr_story.field_npr_primary_image - field.field.node.npr_story.field_npr_primary_topic - field.field.node.npr_story.field_npr_program @@ -30,7 +30,6 @@ dependencies: - field.field.node.npr_story.field_npr_topic - node.type.npr_story module: - - datetime - link - path - text @@ -45,16 +44,6 @@ content: region: content settings: { } third_party_settings: { } - field_external_assets: - weight: 7 - settings: - match_operator: CONTAINS - match_limit: 10 - size: 60 - placeholder: '' - third_party_settings: { } - type: entity_reference_autocomplete - region: content field_npr_additional_images: weight: 5 settings: @@ -86,10 +75,12 @@ content: type: entity_reference_autocomplete region: content field_npr_audio_run_by_date: - weight: 26 - settings: { } + weight: 24 + settings: + size: 60 + placeholder: '' third_party_settings: { } - type: datetime_default + type: string_textfield region: content field_npr_blog: weight: 17 @@ -138,10 +129,12 @@ content: type: entity_reference_autocomplete region: content field_npr_last_modified: - weight: 25 - settings: { } + weight: 23 + settings: + size: 60 + placeholder: '' third_party_settings: { } - type: datetime_default + type: string_textfield region: content field_npr_link: weight: 12 @@ -159,6 +152,16 @@ content: third_party_settings: { } type: string_textfield region: content + field_npr_multimedia: + weight: 7 + settings: + match_operator: CONTAINS + match_limit: 10 + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content field_npr_primary_image: weight: 4 settings: @@ -190,10 +193,12 @@ content: type: entity_reference_autocomplete region: content field_npr_pubdate: - weight: 24 - settings: { } + weight: 25 + settings: + size: 60 + placeholder: '' third_party_settings: { } - type: datetime_default + type: string_textfield region: content field_npr_series: weight: 21 @@ -214,10 +219,12 @@ content: type: string_textfield region: content field_npr_story_date: - weight: 23 - settings: { } + weight: 26 + settings: + size: 60 + placeholder: '' third_party_settings: { } - type: datetime_default + type: string_textfield region: content field_npr_story_id: weight: 0 diff --git a/npr_story/config/optional/core.entity_view_display.media.npr_remote_multimedia.default.yml b/npr_story/config/optional/core.entity_view_display.media.npr_remote_multimedia.default.yml new file mode 100644 index 0000000..292923c --- /dev/null +++ b/npr_story/config/optional/core.entity_view_display.media.npr_remote_multimedia.default.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + config: + - field.field.media.npr_remote_multimedia.field_media_npr_multimedia + - field.field.media.npr_remote_multimedia.field_npr_multimedia_duration + - field.field.media.npr_remote_multimedia.field_npr_multimedia_height + - field.field.media.npr_remote_multimedia.field_npr_multimedia_id + - field.field.media.npr_remote_multimedia.field_npr_multimedia_width + - media.type.npr_remote_multimedia + module: + - npr_story +id: media.npr_remote_multimedia.default +targetEntityType: media +bundle: npr_remote_multimedia +mode: default +content: + field_media_npr_multimedia: + label: hidden + weight: 0 + settings: { } + third_party_settings: { } + type: NPR_Multimedia + region: content +hidden: + created: true + field_npr_multimedia_duration: true + field_npr_multimedia_height: true + field_npr_multimedia_id: true + field_npr_multimedia_width: true + name: true + thumbnail: true + uid: true diff --git a/npr_story/config/optional/core.entity_view_display.node.npr_story.default.yml b/npr_story/config/optional/core.entity_view_display.node.npr_story.default.yml index cff8f86..70fe064 100644 --- a/npr_story/config/optional/core.entity_view_display.node.npr_story.default.yml +++ b/npr_story/config/optional/core.entity_view_display.node.npr_story.default.yml @@ -2,7 +2,6 @@ langcode: en status: true dependencies: config: - - field.field.node.npr_story.field_external_assets - field.field.node.npr_story.field_npr_additional_images - field.field.node.npr_story.field_npr_artist - field.field.node.npr_story.field_npr_audio @@ -15,6 +14,7 @@ dependencies: - field.field.node.npr_story.field_npr_last_modified - field.field.node.npr_story.field_npr_link - field.field.node.npr_story.field_npr_mini_teaser + - field.field.node.npr_story.field_npr_multimedia - field.field.node.npr_story.field_npr_primary_image - field.field.node.npr_story.field_npr_primary_topic - field.field.node.npr_story.field_npr_program @@ -30,8 +30,6 @@ dependencies: - field.field.node.npr_story.field_npr_topic - node.type.npr_story module: - - datetime - - link - text - user id: node.npr_story.default @@ -40,7 +38,7 @@ bundle: npr_story mode: default content: field_npr_artist: - weight: 17 + weight: 11 label: above settings: link: true @@ -49,24 +47,15 @@ content: region: content field_npr_audio: type: entity_reference_entity_view - weight: 2 + weight: 3 label: above settings: view_mode: default link: false third_party_settings: { } region: content - field_npr_audio_run_by_date: - weight: 26 - label: above - settings: - format_type: medium - timezone_override: '' - third_party_settings: { } - type: datetime_default - region: content field_npr_blog: - weight: 14 + weight: 8 label: above settings: link: true @@ -74,14 +63,14 @@ content: type: entity_reference_label region: content field_npr_body: - weight: 3 + weight: 4 label: above settings: { } third_party_settings: { } type: text_default region: content field_npr_byline: - weight: 4 + weight: 2 label: above settings: link_to_entity: false @@ -89,7 +78,7 @@ content: type: string region: content field_npr_categories: - weight: 16 + weight: 10 label: above settings: link: true @@ -97,44 +86,15 @@ content: type: entity_reference_label region: content field_npr_genre: - weight: 15 + weight: 9 label: above settings: link: true third_party_settings: { } type: entity_reference_label region: content - field_npr_last_modified: - weight: 25 - label: above - settings: - format_type: medium - timezone_override: '' - third_party_settings: { } - type: datetime_default - region: content - field_npr_link: - weight: 5 - label: above - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_npr_mini_teaser: - weight: 10 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content field_npr_primary_topic: - weight: 11 + weight: 5 label: above settings: link: true @@ -142,58 +102,31 @@ content: type: entity_reference_label region: content field_npr_program: - weight: 19 + weight: 13 label: above settings: link: true third_party_settings: { } type: entity_reference_label region: content - field_npr_pubdate: - weight: 24 - label: above - settings: - format_type: medium - timezone_override: '' - third_party_settings: { } - type: datetime_default - region: content field_npr_series: - weight: 18 + weight: 12 label: above settings: link: true third_party_settings: { } type: entity_reference_label region: content - field_npr_slug: - weight: 7 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content field_npr_story_date: - weight: 23 - label: above - settings: - format_type: medium - timezone_override: '' - third_party_settings: { } - type: datetime_default - region: content - field_npr_story_id: weight: 1 label: above settings: - thousand_separator: '' - prefix_suffix: true + link_to_entity: false third_party_settings: { } - type: number_integer + type: string region: content field_npr_subtitle: - weight: 8 + weight: 0 label: above settings: link_to_entity: false @@ -201,30 +134,15 @@ content: type: string region: content field_npr_tags: - weight: 13 + weight: 7 label: above settings: link: true third_party_settings: { } type: entity_reference_label region: content - field_npr_teaser: - weight: 9 - label: above - settings: { } - third_party_settings: { } - type: text_default - region: content - field_npr_title_short: - weight: 6 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content field_npr_topic: - weight: 12 + weight: 6 label: above settings: link: true @@ -232,11 +150,20 @@ content: type: entity_reference_label region: content links: - weight: 0 + weight: 14 region: content settings: { } third_party_settings: { } hidden: - field_external_assets: true field_npr_additional_images: true + field_npr_audio_run_by_date: true + field_npr_last_modified: true + field_npr_link: true + field_npr_mini_teaser: true + field_npr_multimedia: true field_npr_primary_image: true + field_npr_pubdate: true + field_npr_slug: true + field_npr_story_id: true + field_npr_teaser: true + field_npr_title_short: true diff --git a/npr_story/config/optional/core.entity_view_display.node.npr_story.teaser.yml b/npr_story/config/optional/core.entity_view_display.node.npr_story.teaser.yml index 14ded76..f680dd6 100644 --- a/npr_story/config/optional/core.entity_view_display.node.npr_story.teaser.yml +++ b/npr_story/config/optional/core.entity_view_display.node.npr_story.teaser.yml @@ -3,7 +3,6 @@ status: true dependencies: config: - core.entity_view_mode.node.teaser - - field.field.node.npr_story.field_external_assets - field.field.node.npr_story.field_npr_additional_images - field.field.node.npr_story.field_npr_artist - field.field.node.npr_story.field_npr_audio @@ -16,6 +15,7 @@ dependencies: - field.field.node.npr_story.field_npr_last_modified - field.field.node.npr_story.field_npr_link - field.field.node.npr_story.field_npr_mini_teaser + - field.field.node.npr_story.field_npr_multimedia - field.field.node.npr_story.field_npr_primary_image - field.field.node.npr_story.field_npr_primary_topic - field.field.node.npr_story.field_npr_program @@ -31,27 +31,18 @@ dependencies: - field.field.node.npr_story.field_npr_topic - node.type.npr_story module: - - text - user id: node.npr_story.teaser targetEntityType: node bundle: npr_story mode: teaser content: - field_npr_teaser: - type: text_default - weight: 1 - region: content - label: hidden - settings: { } - third_party_settings: { } links: - weight: 0 - region: content + weight: 100 settings: { } third_party_settings: { } + region: content hidden: - field_external_assets: true field_npr_additional_images: true field_npr_artist: true field_npr_audio: true @@ -64,6 +55,7 @@ hidden: field_npr_last_modified: true field_npr_link: true field_npr_mini_teaser: true + field_npr_multimedia: true field_npr_primary_image: true field_npr_primary_topic: true field_npr_program: true @@ -74,5 +66,6 @@ hidden: field_npr_story_id: true field_npr_subtitle: true field_npr_tags: true + field_npr_teaser: true field_npr_title_short: true field_npr_topic: true diff --git a/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_media_npr_multimedia.yml b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_media_npr_multimedia.yml new file mode 100644 index 0000000..1006980 --- /dev/null +++ b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_media_npr_multimedia.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_media_npr_multimedia + - media.type.npr_remote_multimedia + module: + - link +id: media.npr_remote_multimedia.field_media_npr_multimedia +field_name: field_media_npr_multimedia +entity_type: media +bundle: npr_remote_multimedia +label: 'NPR Remote Multimedia' +description: '' +required: true +translatable: true +default_value: { } +default_value_callback: '' +settings: + title: 1 + link_type: 17 +field_type: link diff --git a/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_duration.yml b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_duration.yml new file mode 100644 index 0000000..d4c8307 --- /dev/null +++ b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_duration.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_npr_multimedia_duration + - media.type.npr_remote_multimedia +id: media.npr_remote_multimedia.field_npr_multimedia_duration +field_name: field_npr_multimedia_duration +entity_type: media +bundle: npr_remote_multimedia +label: 'NPR Multimedia Duration' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + min: null + max: null + prefix: '' + suffix: '' +field_type: integer diff --git a/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_height.yml b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_height.yml new file mode 100644 index 0000000..17fefe6 --- /dev/null +++ b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_height.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_npr_multimedia_height + - media.type.npr_remote_multimedia +id: media.npr_remote_multimedia.field_npr_multimedia_height +field_name: field_npr_multimedia_height +entity_type: media +bundle: npr_remote_multimedia +label: 'NPR Multimedia Height' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + min: null + max: null + prefix: '' + suffix: '' +field_type: integer diff --git a/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_id.yml b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_id.yml new file mode 100644 index 0000000..73c65ed --- /dev/null +++ b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_id.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_npr_multimedia_id + - media.type.npr_remote_multimedia +id: media.npr_remote_multimedia.field_npr_multimedia_id +field_name: field_npr_multimedia_id +entity_type: media +bundle: npr_remote_multimedia +label: 'NPR Multimedia ID' +description: '' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: + min: null + max: null + prefix: '' + suffix: '' +field_type: integer diff --git a/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_width.yml b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_width.yml new file mode 100644 index 0000000..45155a6 --- /dev/null +++ b/npr_story/config/optional/field.field.media.npr_remote_multimedia.field_npr_multimedia_width.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_npr_multimedia_width + - media.type.npr_remote_multimedia +id: media.npr_remote_multimedia.field_npr_multimedia_width +field_name: field_npr_multimedia_width +entity_type: media +bundle: npr_remote_multimedia +label: 'NPR Multimedia Width' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + min: null + max: null + prefix: '' + suffix: '' +field_type: integer diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_audio_run_by_date.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_audio_run_by_date.yml index 0e9ea5e..0b41589 100644 --- a/npr_story/config/optional/field.field.node.npr_story.field_npr_audio_run_by_date.yml +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_audio_run_by_date.yml @@ -4,17 +4,15 @@ dependencies: config: - field.storage.node.field_npr_audio_run_by_date - node.type.npr_story - module: - - datetime id: node.npr_story.field_npr_audio_run_by_date field_name: field_npr_audio_run_by_date entity_type: node bundle: npr_story label: 'Audio Run By Date' -description: '' +description: 'The date a story will expire out of NPR One. It will still be available as part of the API past this date.' required: false translatable: false default_value: { } default_value_callback: '' settings: { } -field_type: datetime +field_type: string diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_last_modified.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_last_modified.yml index f9f9bb3..2bfbd2f 100644 --- a/npr_story/config/optional/field.field.node.npr_story.field_npr_last_modified.yml +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_last_modified.yml @@ -4,17 +4,15 @@ dependencies: config: - field.storage.node.field_npr_last_modified - node.type.npr_story - module: - - datetime id: node.npr_story.field_npr_last_modified field_name: field_npr_last_modified entity_type: node bundle: npr_story -label: 'Last Modified Date' -description: 'The date/time the story was last modified in any capacity on NPR.org.' +label: 'Last Modified' +description: "The date/time the returned story was last modified in any capacity to NPR.org.\t" required: false translatable: false default_value: { } default_value_callback: '' settings: { } -field_type: datetime +field_type: string diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_multimedia.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_multimedia.yml new file mode 100644 index 0000000..582f131 --- /dev/null +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_multimedia.yml @@ -0,0 +1,27 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_npr_multimedia + - media.type.npr_remote_multimedia + - node.type.npr_story +id: node.npr_story.field_npr_multimedia +field_name: field_npr_multimedia +entity_type: node +bundle: npr_story +label: Multimedia +description: 'Embedded multimedia from NPR, such as Tiny Desk Concerts' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:media' + handler_settings: + target_bundles: + npr_remote_multimedia: npr_remote_multimedia + sort: + field: _none + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_pubdate.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_pubdate.yml index f15e56e..52308f2 100644 --- a/npr_story/config/optional/field.field.node.npr_story.field_npr_pubdate.yml +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_pubdate.yml @@ -4,17 +4,15 @@ dependencies: config: - field.storage.node.field_npr_pubdate - node.type.npr_story - module: - - datetime id: node.npr_story.field_npr_pubdate field_name: field_npr_pubdate entity_type: node bundle: npr_story label: 'Publication Date' -description: 'The date/time the story was initially published to NPR.org, or the last date a significant update was published to NPR.org.' +description: "The date/the returned time the story was initially published to NPR.org, or the last date a significant update was published to NPR.org.\t" required: false translatable: false default_value: { } default_value_callback: '' settings: { } -field_type: datetime +field_type: string diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_story_date.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_story_date.yml index 37d36dd..90087cf 100644 --- a/npr_story/config/optional/field.field.node.npr_story.field_npr_story_date.yml +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_story_date.yml @@ -4,17 +4,15 @@ dependencies: config: - field.storage.node.field_npr_story_date - node.type.npr_story - module: - - datetime id: node.npr_story.field_npr_story_date field_name: field_npr_story_date entity_type: node bundle: npr_story label: 'Story Date' -description: 'The primary date/time associated with the publication of the story.' +description: "The primary date/time associated with the publication of the returned story to NPR.org.\t" required: false translatable: false default_value: { } default_value_callback: '' settings: { } -field_type: datetime +field_type: string diff --git a/npr_story/config/optional/field.field.node.npr_story.field_npr_teaser.yml b/npr_story/config/optional/field.field.node.npr_story.field_npr_teaser.yml index 737f2b8..7716c2c 100644 --- a/npr_story/config/optional/field.field.node.npr_story.field_npr_teaser.yml +++ b/npr_story/config/optional/field.field.node.npr_story.field_npr_teaser.yml @@ -5,15 +5,7 @@ dependencies: - field.storage.node.field_npr_teaser - node.type.npr_story module: - - allowed_formats - text -third_party_settings: - allowed_formats: - basic_html: '0' - npr_story: '0' - restricted_html: '0' - full_html: '0' - plain_text: '0' id: node.npr_story.field_npr_teaser field_name: field_npr_teaser entity_type: node diff --git a/npr_story/config/optional/field.storage.media.field_media_npr_multimedia.yml b/npr_story/config/optional/field.storage.media.field_media_npr_multimedia.yml new file mode 100644 index 0000000..a130972 --- /dev/null +++ b/npr_story/config/optional/field.storage.media.field_media_npr_multimedia.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + module: + - link + - media +id: media.field_media_npr_multimedia +field_name: field_media_npr_multimedia +entity_type: media +type: link +settings: { } +module: link +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.media.field_npr_multimedia_duration.yml b/npr_story/config/optional/field.storage.media.field_npr_multimedia_duration.yml new file mode 100644 index 0000000..aeb5b36 --- /dev/null +++ b/npr_story/config/optional/field.storage.media.field_npr_multimedia_duration.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media +id: media.field_npr_multimedia_duration +field_name: field_npr_multimedia_duration +entity_type: media +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.media.field_npr_multimedia_height.yml b/npr_story/config/optional/field.storage.media.field_npr_multimedia_height.yml new file mode 100644 index 0000000..c1d94b8 --- /dev/null +++ b/npr_story/config/optional/field.storage.media.field_npr_multimedia_height.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media +id: media.field_npr_multimedia_height +field_name: field_npr_multimedia_height +entity_type: media +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.media.field_npr_multimedia_id.yml b/npr_story/config/optional/field.storage.media.field_npr_multimedia_id.yml new file mode 100644 index 0000000..7b65245 --- /dev/null +++ b/npr_story/config/optional/field.storage.media.field_npr_multimedia_id.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media +id: media.field_npr_multimedia_id +field_name: field_npr_multimedia_id +entity_type: media +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.media.field_npr_multimedia_width.yml b/npr_story/config/optional/field.storage.media.field_npr_multimedia_width.yml new file mode 100644 index 0000000..02ca23f --- /dev/null +++ b/npr_story/config/optional/field.storage.media.field_npr_multimedia_width.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media +id: media.field_npr_multimedia_width +field_name: field_npr_multimedia_width +entity_type: media +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.node.field_npr_audio_run_by_date.yml b/npr_story/config/optional/field.storage.node.field_npr_audio_run_by_date.yml index b0ebe75..eefd6e0 100644 --- a/npr_story/config/optional/field.storage.node.field_npr_audio_run_by_date.yml +++ b/npr_story/config/optional/field.storage.node.field_npr_audio_run_by_date.yml @@ -2,15 +2,16 @@ langcode: en status: true dependencies: module: - - datetime - node id: node.field_npr_audio_run_by_date field_name: field_npr_audio_run_by_date entity_type: node -type: datetime +type: string settings: - datetime_type: datetime -module: datetime + max_length: 255 + is_ascii: false + case_sensitive: false +module: core locked: false cardinality: 1 translatable: true diff --git a/npr_story/config/optional/field.storage.node.field_npr_last_modified.yml b/npr_story/config/optional/field.storage.node.field_npr_last_modified.yml index 55a8fcc..f48c55c 100644 --- a/npr_story/config/optional/field.storage.node.field_npr_last_modified.yml +++ b/npr_story/config/optional/field.storage.node.field_npr_last_modified.yml @@ -2,15 +2,16 @@ langcode: en status: true dependencies: module: - - datetime - node id: node.field_npr_last_modified field_name: field_npr_last_modified entity_type: node -type: datetime +type: string settings: - datetime_type: datetime -module: datetime + max_length: 255 + is_ascii: false + case_sensitive: false +module: core locked: false cardinality: 1 translatable: true diff --git a/npr_story/config/optional/field.storage.node.field_npr_multimedia.yml b/npr_story/config/optional/field.storage.node.field_npr_multimedia.yml new file mode 100644 index 0000000..4fc2c1e --- /dev/null +++ b/npr_story/config/optional/field.storage.node.field_npr_multimedia.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + module: + - media + - node +id: node.field_npr_multimedia +field_name: field_npr_multimedia +entity_type: node +type: entity_reference +settings: + target_type: media +module: core +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/npr_story/config/optional/field.storage.node.field_npr_pubdate.yml b/npr_story/config/optional/field.storage.node.field_npr_pubdate.yml index 0277aee..65e70a5 100644 --- a/npr_story/config/optional/field.storage.node.field_npr_pubdate.yml +++ b/npr_story/config/optional/field.storage.node.field_npr_pubdate.yml @@ -2,15 +2,16 @@ langcode: en status: true dependencies: module: - - datetime - node id: node.field_npr_pubdate field_name: field_npr_pubdate entity_type: node -type: datetime +type: string settings: - datetime_type: datetime -module: datetime + max_length: 255 + is_ascii: false + case_sensitive: false +module: core locked: false cardinality: 1 translatable: true diff --git a/npr_story/config/optional/field.storage.node.field_npr_story_date.yml b/npr_story/config/optional/field.storage.node.field_npr_story_date.yml index c02ccb4..a8508ea 100644 --- a/npr_story/config/optional/field.storage.node.field_npr_story_date.yml +++ b/npr_story/config/optional/field.storage.node.field_npr_story_date.yml @@ -2,15 +2,16 @@ langcode: en status: true dependencies: module: - - datetime - node id: node.field_npr_story_date field_name: field_npr_story_date entity_type: node -type: datetime +type: string settings: - datetime_type: datetime -module: datetime + max_length: 255 + is_ascii: false + case_sensitive: false +module: core locked: false cardinality: 1 translatable: true diff --git a/npr_story/config/optional/filter.format.npr_story.yml b/npr_story/config/optional/filter.format.npr_story.yml index 5a07d7a..4e7a0b6 100644 --- a/npr_story/config/optional/filter.format.npr_story.yml +++ b/npr_story/config/optional/filter.format.npr_story.yml @@ -14,7 +14,12 @@ filters: status: true weight: -10 settings: - allowed_html: '