Loading core/modules/media_library/media_library.module +1 −2 Original line number Diff line number Diff line Loading @@ -402,8 +402,7 @@ function _media_library_configure_form_display(MediaTypeInterface $type) { $display->removeComponent($name); } // Expose the name field when it is not mapped. $field_map = $type->getFieldMap(); if (empty($field_map['name'])) { if (!in_array('name', $type->getFieldMap(), TRUE)) { $display->setComponent('name', [ 'type' => 'string_textfield', 'settings' => [ Loading core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,22 @@ public function testDisplayModes() { $this->assertFormDisplay($type_eight_id, FALSE, TRUE); $this->assertViewDisplay($type_eight_id, 'medium'); // Create an oEmbed media type with a mapped name field in the UI. $type_id = 'pinto_bean'; $edit = [ 'label' => $type_id, 'id' => $type_id, 'source' => 'oembed:video', ]; $this->drupalPostForm('admin/structure/media/add', $edit, 'Save'); $edit = [ 'field_map[title]' => 'name', ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertSession()->pageTextContains("Media Library form and view displays have been created for the $type_id media type."); $this->assertFormDisplay($type_id, FALSE, FALSE); $this->assertViewDisplay($type_id, 'medium'); // Delete a form and view display. EntityFormDisplay::load('media.type_one.media_library')->delete(); EntityViewDisplay::load('media.type_one.media_library')->delete(); Loading Loading
core/modules/media_library/media_library.module +1 −2 Original line number Diff line number Diff line Loading @@ -402,8 +402,7 @@ function _media_library_configure_form_display(MediaTypeInterface $type) { $display->removeComponent($name); } // Expose the name field when it is not mapped. $field_map = $type->getFieldMap(); if (empty($field_map['name'])) { if (!in_array('name', $type->getFieldMap(), TRUE)) { $display->setComponent('name', [ 'type' => 'string_textfield', 'settings' => [ Loading
core/modules/media_library/tests/src/Functional/MediaLibraryDisplayModeTest.php +16 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,22 @@ public function testDisplayModes() { $this->assertFormDisplay($type_eight_id, FALSE, TRUE); $this->assertViewDisplay($type_eight_id, 'medium'); // Create an oEmbed media type with a mapped name field in the UI. $type_id = 'pinto_bean'; $edit = [ 'label' => $type_id, 'id' => $type_id, 'source' => 'oembed:video', ]; $this->drupalPostForm('admin/structure/media/add', $edit, 'Save'); $edit = [ 'field_map[title]' => 'name', ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertSession()->pageTextContains("Media Library form and view displays have been created for the $type_id media type."); $this->assertFormDisplay($type_id, FALSE, FALSE); $this->assertViewDisplay($type_id, 'medium'); // Delete a form and view display. EntityFormDisplay::load('media.type_one.media_library')->delete(); EntityViewDisplay::load('media.type_one.media_library')->delete(); Loading