Commit 05a11424 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #2964640 by chr.fritsch, starshaped, andrewmacpherson, webchick,...

Issue #2964640 by chr.fritsch, starshaped, andrewmacpherson, webchick, phenaproxima: Provide a media type for remote video in Standard
parent 4e8c573d
langcode: en
status: true
dependencies:
config:
- field.field.media.remote_video.field_media_oembed_video
- media.type.remote_video
module:
- media
- path
id: media.remote_video.default
targetEntityType: media
bundle: remote_video
mode: default
content:
created:
type: datetime_timestamp
weight: 10
region: content
settings: { }
third_party_settings: { }
field_media_oembed_video:
type: oembed_textfield
weight: 0
settings:
size: 60
placeholder: ''
third_party_settings: { }
region: content
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: ''
region: content
third_party_settings: { }
hidden:
name: true
langcode: en
status: true
dependencies:
config:
- field.field.media.remote_video.field_media_oembed_video
- media.type.remote_video
module:
- media
id: media.remote_video.default
targetEntityType: media
bundle: remote_video
mode: default
content:
field_media_oembed_video:
type: oembed
weight: 0
label: hidden
settings:
max_width: 0
max_height: 0
third_party_settings: { }
region: content
hidden:
created: true
name: true
thumbnail: true
uid: true
langcode: en
status: true
dependencies:
config:
- field.storage.media.field_media_oembed_video
- media.type.remote_video
id: media.remote_video.field_media_oembed_video
field_name: field_media_oembed_video
entity_type: media
bundle: remote_video
label: 'Video URL'
description: ''
required: true
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
langcode: en
status: true
dependencies:
module:
- media
id: media.field_media_oembed_video
field_name: field_media_oembed_video
entity_type: media
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies: { }
id: remote_video
label: 'Remote video'
description: 'A remotely hosted video from YouTube or Vimeo.'
source: 'oembed:video'
queue_thumbnail_downloads: false
new_revision: false
source_configuration:
thumbnails_directory: 'public://oembed_thumbnails'
providers:
- YouTube
- Vimeo
source_field: field_media_oembed_video
field_map: { }
......@@ -232,6 +232,7 @@ public function testStandard() {
$this->adminUser->addRole($role->id());
$this->adminUser->save();
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
/** @var \Drupal\media\Entity\MediaType $media_type */
foreach (MediaType::loadMultiple() as $media_type) {
$media_type_machine_name = $media_type->id();
......@@ -241,14 +242,16 @@ public function testStandard() {
$form = $assert_session->elementExists('css', $form_selector);
$form_html = $form->getOuterHtml();
// The name field should come before the source field, which should itself
// come before the vertical tabs.
$name_field = $assert_session->fieldExists('Name', $form)->getOuterHtml();
// The name field (if it exists) should come before the source field,
// which should itself come before the vertical tabs.
$test_source_field = $assert_session->fieldExists($media_type->getSource()->getSourceFieldDefinition($media_type)->getLabel(), $form)->getOuterHtml();
$vertical_tabs = $assert_session->elementExists('css', '.form-type-vertical-tabs', $form)->getOuterHtml();
$date_field = $assert_session->fieldExists('Date', $form)->getOuterHtml();
$published_checkbox = $assert_session->fieldExists('Published', $form)->getOuterHtml();
$this->assertTrue(strpos($form_html, $test_source_field) > strpos($form_html, $name_field));
if ($page->findField('Name')) {
$name_field = $assert_session->fieldExists('Name', $form)->getOuterHtml();
$this->assertTrue(strpos($form_html, $test_source_field) > strpos($form_html, $name_field));
}
$this->assertTrue(strpos($form_html, $vertical_tabs) > strpos($form_html, $test_source_field));
// The "Published" checkbox should be the last element.
$this->assertTrue(strpos($form_html, $published_checkbox) > strpos($form_html, $date_field));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment