Skip to content

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Oct 15, 2019
2 parents c222741 + ef72718 commit ec70fa9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/behat/features/fields.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Feature: Fields for different Media types
And I should see "Allowed types: png gif jpg jpeg svg." in the "#edit-field-media-image-0-upload--description" element

And I attach the file "SampleJPGImage_50kbmb.jpg" to "Image"
And I wait 60 seconds for AJAX to finish
And I wait 80 seconds for AJAX to finish
Then I should see the text "Alternative text"
And I should see the text "Title"

Expand Down
29 changes: 29 additions & 0 deletions tide_media.install
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,32 @@ function tide_media_update_8006() {
}
drupal_flush_all_caches();
}

/**
* Enable the field_media_site field in form_display of all media bundles.
*/
function tide_media_update_8007() {
if (!\Drupal::moduleHandler()->moduleExists('tide_site')) {
return;
}
// Default settings.
$default_option = [
'type' => 'options_buttons',
'region' => 'content',
'settings' => [],
'third_party_settings' => [],
];
$bundle_info_service = \Drupal::service('entity_type.bundle.info');
$entity_form_display_storage = \Drupal::entityTypeManager()
->getStorage('entity_form_display');
$media_bundles = $bundle_info_service->getBundleInfo('media');
if (!empty($media_bundles) && is_array($media_bundles)) {
// Enable the field in form_display of all media bundles.
foreach ($media_bundles as $name => $options) {
/** @var \Drupal\Core\Entity\Entity\EntityFormDisplay $entity_form_display */
$entity_form_display = $entity_form_display_storage->load('media.' . $name . '.default');
$entity_form_display->setComponent('field_media_site', $default_option);
$entity_form_display->save();
}
}
}

0 comments on commit ec70fa9

Please sign in to comment.