diff --git a/UPDATE.md b/UPDATE.md index 92e1ffe1e..8fbe590e4 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -54,6 +54,32 @@ use. For example, if you are currently running Beta 1 and are trying to update to Beta 3, you will need to follow the instructions for updating from Beta 1 to Beta 2, then from Beta 2 to Beta 3, in that order. +## 2.1.5 to 2.1.6 +This version of Lightning adds the ability to choose an image style, alt text, +and other settings each time you embed an image in a WYSIWYG editor, rather +that needing to rely on view modes. To enable this functionality: + +1. As always, visit ```update.php``` or run ```drush updatedb``` to perform + database updates. +1. Clear all caches. +1. Under *Configuration > Content Authoring > Text formats and editors*, + configure the **Rich Text** filter format. Under "Filter settings", open the + tab labeled "Limit allowed HTML tags and correct faulty HTML". +1. In the "Allowed HTML tags" text field, you should see a tag like + ``. Change it to ``. +1. Save the filter format. +1. Under *Configuration > Content Authoring > Text editor embed buttons*, edit + the "Media browser" embed button. +1. Under "Allowed Entity Embed Display plugins", ensure that the "Media Image" + checkbox is checked. +1. Save the embed button. +1. If you would like to allow authors to choose how embedded media should be + displayed, go to *Configuration > System > Lightning > Media*, ensure that + the box labeled "Allow users to choose how to display embedded media" is + checked, then submit the form. If the box is not checked, Lightning will + automatically choose a preferred display method (the recommended, default + behavior). + ## 2.1.4 to 2.1.5 There are no manual update steps for this version. diff --git a/lightning.install b/lightning.install index 2e0df1a76..4906e59a8 100644 --- a/lightning.install +++ b/lightning.install @@ -7,6 +7,7 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\field\Entity\FieldConfig; +use Drupal\lightning_core\ConfigHelper as Config; use Drupal\user\Entity\User; use Drupal\user\RoleInterface; @@ -457,7 +458,8 @@ function lightning_update_8001() { // Install the body field on the basic block_content type. $field = FieldConfig::load('block_content.basic.body'); if (empty($field)) { - lightning_core_create_config('field_config', 'block_content.basic.body', 'lightning'); + $config = Config::forModule('lightning'); + $config->getEntity('field_config', 'block_content.basic.body')->save(); $display = EntityViewDisplay::load('block_content.basic.default'); if ($display) { @@ -471,7 +473,7 @@ function lightning_update_8001() { ])->save(); } else { - lightning_core_create_config('entity_view_display', 'block_content.basic.default', 'lightning'); + $config->getEntity('entity_view_display', 'block_content.basic.default')->save(); } } diff --git a/modules/lightning_features/lightning_core/modules/lightning_dev/lightning_dev.install b/modules/lightning_features/lightning_core/modules/lightning_dev/lightning_dev.install index e1a50129e..5975fbb0c 100644 --- a/modules/lightning_features/lightning_core/modules/lightning_dev/lightning_dev.install +++ b/modules/lightning_features/lightning_core/modules/lightning_dev/lightning_dev.install @@ -5,9 +5,11 @@ * Contains installation and update routines for Lightning Dev. */ +use Drupal\embed\Entity\EmbedButton; use Drupal\entity_browser\Entity\EntityBrowser; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\filter\Entity\FilterFormat; use Drupal\lightning_core\ConfigHelper as Config; use Drupal\media_entity\Entity\MediaBundle; use Drupal\scheduled_updates\Entity\ScheduledUpdateType; @@ -192,3 +194,20 @@ function lightning_dev_update_8005() { $display['display_options']['filters']['bundle']['expose']['argument'] = 'bundle'; $view->save(); } + +/** + * Executes manual updates for Lightning 2.1.5 --> 2.1.6. + */ +function lightning_dev_update_8006() { + \Drupal::service('plugin.manager.embed.type')->clearCachedDefinitions(); + + $button = EmbedButton::load('media_browser'); + $settings = $button->getTypeSettings(); + $settings['display_plugins'][] = 'media_image'; + $button->set('type_settings', $settings)->save(); + + $format = FilterFormat::load('rich_text'); + $configuration = $format->filters('filter_html')->getConfiguration(); + $configuration['settings']['allowed_html'] = str_replace('', '', $configuration['settings']['allowed_html']); + $format->setFilterConfig('filter_html', $configuration)->save(); +} diff --git a/modules/lightning_features/lightning_core/modules/lightning_test/lightning_test.install b/modules/lightning_features/lightning_core/modules/lightning_test/lightning_test.install index 5b29b7c9f..607e4511d 100644 --- a/modules/lightning_features/lightning_core/modules/lightning_test/lightning_test.install +++ b/modules/lightning_features/lightning_core/modules/lightning_test/lightning_test.install @@ -81,21 +81,6 @@ function lightning_test_install() { ], 'region' => 'content', ]) - ->setComponent('field_z_image', [ - 'type' => 'entity_browser_entity_reference', - 'settings' => [ - 'entity_browser' => 'media_browser', - 'field_widget_display' => 'rendered_entity', - 'field_widget_edit' => TRUE, - 'field_widget_remove' => TRUE, - 'selection_mode' => EntityBrowserElement::SELECTION_MODE_APPEND, - 'field_widget_display_settings' => [ - 'view_mode' => 'embedded', - ], - 'open' => TRUE, - ], - 'region' => 'content', - ]) ->save(); $display = entity_get_form_display('media', 'video', 'default'); @@ -144,9 +129,4 @@ function lightning_test_uninstall() { } } $state->delete('_fields'); - - \Drupal::entityTypeManager() - ->getStorage('media_bundle') - ->load('z_image') - ->delete(); } diff --git a/modules/lightning_features/lightning_core/src/ConfigHelper.php b/modules/lightning_features/lightning_core/src/ConfigHelper.php index b1edd0819..84dd6d444 100644 --- a/modules/lightning_features/lightning_core/src/ConfigHelper.php +++ b/modules/lightning_features/lightning_core/src/ConfigHelper.php @@ -128,7 +128,7 @@ public function delete($id) { if (Unicode::strpos($id, $prefix) === 0) { $entity = $this->getEntity( $entity_type, - Unicode::substr($id, Unicode::strlen($prefix) + 1) + Unicode::substr($id, Unicode::strlen($prefix)) ); return $entity->delete(); } diff --git a/modules/lightning_features/lightning_media/config/install/embed.button.media_browser.yml b/modules/lightning_features/lightning_media/config/install/embed.button.media_browser.yml index d28da8f3b..c389e0b70 100644 --- a/modules/lightning_features/lightning_media/config/install/embed.button.media_browser.yml +++ b/modules/lightning_features/lightning_media/config/install/embed.button.media_browser.yml @@ -12,6 +12,7 @@ type_settings: bundles: { } display_plugins: - 'entity_reference:entity_reference_entity_view' + - media_image entity_browser: media_browser entity_browser_settings: display_review: false diff --git a/modules/lightning_features/lightning_media/config/install/filter.format.rich_text.yml b/modules/lightning_features/lightning_media/config/install/filter.format.rich_text.yml index 4155bb9a2..98581f9f5 100644 --- a/modules/lightning_features/lightning_media/config/install/filter.format.rich_text.yml +++ b/modules/lightning_features/lightning_media/config/install/filter.format.rich_text.yml @@ -4,8 +4,6 @@ dependencies: module: - editor - entity_embed -_core: - default_config_hash: ba3RWDN1-BRYH1z2GlIchbXVWirdh7mDbsjSmbCmbIw name: 'Rich Text' format: rich_text weight: 1 @@ -46,7 +44,7 @@ filters: status: true weight: -50 settings: - allowed_html: '