Loading core/modules/media/src/MediaTypeForm.php +2 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public function form(array $form, FormStateInterface $form_state) { } } natcasesort($options); $field_map = $this->entity->getFieldMap(); foreach ($source->getMetadataAttributes() as $metadata_attribute_name => $metadata_attribute_label) { $form['source_dependent']['field_map'][$metadata_attribute_name] = [ Loading core/modules/media/tests/src/FunctionalJavascript/MediaTypeCreationTest.php +7 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,13 @@ public function testMediaTypeCreationFormWithDefaultField() { $assert_session->fieldDisabled('Media source'); $assert_session->pageTextContains('The media source cannot be changed after the media type is created.'); // Check that the field map options are sorted alphabetically. $options = $this->xpath('//select[@name="field_map[attribute_1]"]/option'); $this->assertGreaterThanOrEqual(3, count($options)); $this->assertSame('- Skip field -', $options[0]->getText()); $this->assertSame('Name', $options[1]->getText()); $this->assertSame('Test source', $options[2]->getText()); // Open up the media add form and verify that the source field is right // after the name, and before the vertical tabs. $this->drupalGet("/media/add/$mediaTypeMachineName"); Loading Loading
core/modules/media/src/MediaTypeForm.php +2 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public function form(array $form, FormStateInterface $form_state) { } } natcasesort($options); $field_map = $this->entity->getFieldMap(); foreach ($source->getMetadataAttributes() as $metadata_attribute_name => $metadata_attribute_label) { $form['source_dependent']['field_map'][$metadata_attribute_name] = [ Loading
core/modules/media/tests/src/FunctionalJavascript/MediaTypeCreationTest.php +7 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,13 @@ public function testMediaTypeCreationFormWithDefaultField() { $assert_session->fieldDisabled('Media source'); $assert_session->pageTextContains('The media source cannot be changed after the media type is created.'); // Check that the field map options are sorted alphabetically. $options = $this->xpath('//select[@name="field_map[attribute_1]"]/option'); $this->assertGreaterThanOrEqual(3, count($options)); $this->assertSame('- Skip field -', $options[0]->getText()); $this->assertSame('Name', $options[1]->getText()); $this->assertSame('Test source', $options[2]->getText()); // Open up the media add form and verify that the source field is right // after the name, and before the vertical tabs. $this->drupalGet("/media/add/$mediaTypeMachineName"); Loading