diff --git a/config/install/core.entity_view_display.media.audio.default.yml b/config/install/core.entity_view_display.media.audio.default.yml index 51a961a..70b637e 100644 --- a/config/install/core.entity_view_display.media.audio.default.yml +++ b/config/install/core.entity_view_display.media.audio.default.yml @@ -16,6 +16,7 @@ dependencies: - media.type.audio module: - file + - smart_trim - svg_image - text - user @@ -116,6 +117,23 @@ content: label: above settings: { } third_party_settings: { } + name: + type: smart_trim + weight: 13 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } thumbnail: type: image weight: 2 @@ -124,8 +142,8 @@ content: image_style: thumbnail image_link: '' svg_attributes: - width: '' - height: '' + width: null + height: null svg_render_as_image: true region: content third_party_settings: { } @@ -136,5 +154,4 @@ content: region: content settings: { } third_party_settings: { } -hidden: - name: true +hidden: { } diff --git a/config/install/core.entity_view_display.media.audio.embedded.yml b/config/install/core.entity_view_display.media.audio.embedded.yml index 7e8ee87..66bbfb5 100644 --- a/config/install/core.entity_view_display.media.audio.embedded.yml +++ b/config/install/core.entity_view_display.media.audio.embedded.yml @@ -15,13 +15,14 @@ dependencies: - media.type.audio module: - media_entity_audio + - smart_trim id: media.audio.embedded targetEntityType: media bundle: audio mode: embedded content: field_media_file: - weight: 6 + weight: 0 label: hidden settings: provide_download_link: '1' @@ -29,6 +30,23 @@ content: third_party_settings: { } type: audio_stream_html5 region: content + name: + type: smart_trim + weight: 1 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } hidden: created: true field_license_type: true @@ -40,6 +58,5 @@ hidden: field_media_summary: true field_media_topic: true field_media_transcript: true - name: true thumbnail: true uid: true diff --git a/config/install/core.entity_view_display.media.audio.embedded_with_transcript.yml b/config/install/core.entity_view_display.media.audio.embedded_with_transcript.yml index 18e089d..bb69a75 100644 --- a/config/install/core.entity_view_display.media.audio.embedded_with_transcript.yml +++ b/config/install/core.entity_view_display.media.audio.embedded_with_transcript.yml @@ -15,13 +15,14 @@ dependencies: - media.type.audio module: - media_entity_audio + - smart_trim id: media.audio.embedded_with_transcript targetEntityType: media bundle: audio mode: embedded_with_transcript content: field_media_file: - weight: 0 + weight: 1 label: hidden settings: provide_download_link: '1' @@ -30,12 +31,29 @@ content: type: audio_stream_html5 region: content field_media_transcript: - weight: 1 + weight: 2 label: above settings: { } third_party_settings: { } type: basic_string region: content + name: + type: smart_trim + weight: 0 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } hidden: created: true field_license_type: true @@ -46,6 +64,5 @@ hidden: field_media_show_transcript: true field_media_summary: true field_media_topic: true - name: true thumbnail: true uid: true diff --git a/config/install/core.entity_view_display.media.audio.media_browser_preview.yml b/config/install/core.entity_view_display.media.audio.media_browser_preview.yml index e5abb21..bb2e333 100644 --- a/config/install/core.entity_view_display.media.audio.media_browser_preview.yml +++ b/config/install/core.entity_view_display.media.audio.media_browser_preview.yml @@ -15,6 +15,7 @@ dependencies: - image.style.thumbnail - media.type.audio module: + - smart_trim - svg_image id: media.audio.media_browser_preview targetEntityType: media @@ -22,12 +23,21 @@ bundle: audio mode: media_browser_preview content: name: - type: string + type: smart_trim weight: 1 region: content - label: visually_hidden + label: hidden settings: - link_to_entity: false + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } third_party_settings: { } thumbnail: type: image @@ -36,6 +46,10 @@ content: settings: image_style: thumbnail image_link: '' + svg_attributes: + width: null + height: null + svg_render_as_image: true region: content third_party_settings: { } hidden: diff --git a/config/install/core.entity_view_display.media.embedded_video.default.yml b/config/install/core.entity_view_display.media.embedded_video.default.yml index c4b43e6..24a645f 100644 --- a/config/install/core.entity_view_display.media.embedded_video.default.yml +++ b/config/install/core.entity_view_display.media.embedded_video.default.yml @@ -14,6 +14,7 @@ dependencies: - field.field.media.embedded_video.field_media_video_embed_field - media.type.embedded_video module: + - smart_trim - text - user - video_embed_field @@ -115,6 +116,23 @@ content: third_party_settings: { } type: video_embed_field_video region: content + name: + type: smart_trim + weight: 12 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } uid: label: hidden type: author @@ -123,5 +141,4 @@ content: settings: { } third_party_settings: { } hidden: - name: true thumbnail: true diff --git a/config/install/core.entity_view_display.media.embedded_video.embedded.yml b/config/install/core.entity_view_display.media.embedded_video.embedded.yml index 97f5ee5..2d916a5 100644 --- a/config/install/core.entity_view_display.media.embedded_video.embedded.yml +++ b/config/install/core.entity_view_display.media.embedded_video.embedded.yml @@ -14,6 +14,7 @@ dependencies: - field.field.media.embedded_video.field_media_video_embed_field - media.type.embedded_video module: + - smart_trim - video_embed_field id: media.embedded_video.embedded targetEntityType: media @@ -31,6 +32,23 @@ content: third_party_settings: { } type: video_embed_field_video region: content + name: + type: smart_trim + weight: 1 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } hidden: created: true field_license_type: true @@ -42,6 +60,5 @@ hidden: field_media_summary: true field_media_topic: true field_media_transcript: true - name: true thumbnail: true uid: true diff --git a/config/install/core.entity_view_display.media.embedded_video.embedded_with_transcript.yml b/config/install/core.entity_view_display.media.embedded_video.embedded_with_transcript.yml index a01ce82..6e8ca2c 100644 --- a/config/install/core.entity_view_display.media.embedded_video.embedded_with_transcript.yml +++ b/config/install/core.entity_view_display.media.embedded_video.embedded_with_transcript.yml @@ -14,6 +14,7 @@ dependencies: - field.field.media.embedded_video.field_media_video_embed_field - media.type.embedded_video module: + - smart_trim - video_embed_field id: media.embedded_video.embedded_with_transcript targetEntityType: media @@ -39,6 +40,23 @@ content: third_party_settings: { } type: video_embed_field_video region: content + name: + type: smart_trim + weight: 2 + region: content + label: hidden + settings: + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } + third_party_settings: { } hidden: created: true field_license_type: true @@ -49,6 +67,5 @@ hidden: field_media_summary: true field_media_topic: true field_media_transcript: true - name: true thumbnail: true uid: true diff --git a/config/install/core.entity_view_display.media.embedded_video.media_browser_preview.yml b/config/install/core.entity_view_display.media.embedded_video.media_browser_preview.yml index 22a3e4c..ce25fa0 100644 --- a/config/install/core.entity_view_display.media.embedded_video.media_browser_preview.yml +++ b/config/install/core.entity_view_display.media.embedded_video.media_browser_preview.yml @@ -15,6 +15,7 @@ dependencies: - image.style.thumbnail - media.type.embedded_video module: + - smart_trim - svg_image id: media.embedded_video.media_browser_preview targetEntityType: media @@ -22,12 +23,21 @@ bundle: embedded_video mode: media_browser_preview content: name: - type: string + type: smart_trim weight: 1 region: content - label: visually_hidden + label: hidden settings: - link_to_entity: false + trim_length: 600 + trim_type: chars + trim_suffix: '' + wrap_output: false + wrap_class: trimmed + more_link: false + more_class: more-link + more_text: More + summary_handler: full + trim_options: { } third_party_settings: { } thumbnail: type: image @@ -36,6 +46,10 @@ content: settings: image_style: thumbnail image_link: '' + svg_attributes: + width: null + height: null + svg_render_as_image: true region: content third_party_settings: { } hidden: diff --git a/tide_media.info.yml b/tide_media.info.yml index ffc3232..2532ad0 100644 --- a/tide_media.info.yml +++ b/tide_media.info.yml @@ -23,6 +23,7 @@ dependencies: - svg_image:svg_image - video_embed_field:video_embed_field - video_embed_field:video_embed_media + - smart_trim:smart_trim config_devel: install: - core.entity_form_display.media.audio.default diff --git a/tide_media.install b/tide_media.install index e712279..cf48eb1 100644 --- a/tide_media.install +++ b/tide_media.install @@ -653,3 +653,37 @@ function tide_media_update_8040() { TideOperation::tideMediaInstallModule('entity_usage'); TideOperation::entityUsageDefaultSettings(); } + +/** + * Add name field to all view modes. + */ +function tide_media_update_8041() { + TideOperation::tideMediaInstallModule('smart_trim'); + module_load_include('inc', 'tide_core', 'includes/helpers'); + $config_location = [drupal_get_path('module', 'tide_media') . '/config/install']; + + $modes = [ + 'default', + 'embedded', + 'embedded_with_transcript', + 'media_browser_preview', + ]; + + foreach ($modes as $mode) { + /** @var \Drupal\Core\Entity\Entity\EntityViewDisplay $view_display */ + $view_display = \Drupal::entityTypeManager() + ->getStorage('entity_view_display') + ->load('media.embedded_video.' . $mode); + if (!$view_display) { + _tide_import_single_config('core.entity_view_display.media.embedded_video.' . $mode, $config_location, FALSE); + } + + /** @var \Drupal\Core\Entity\Entity\EntityViewDisplay $view_display_audio */ + $view_display_audio = \Drupal::entityTypeManager() + ->getStorage('entity_view_display') + ->load('media.audio.' . $mode); + if (!$view_display_audio) { + _tide_import_single_config('core.entity_view_display.media.audio.' . $mode, $config_location, FALSE); + } + } +}