Loading core/modules/ckeditor5/tests/fixtures/ckeditor4_config/filter.format.basic_html.yml +14 −14 Original line number Diff line number Diff line Loading @@ -9,15 +9,12 @@ weight: 0 roles: - authenticated filters: filter_html: id: filter_html provider: filter editor_file_reference: id: editor_file_reference provider: editor status: true weight: -10 settings: allowed_html: '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-entity-type data-entity-uuid data-align data-caption>' filter_html_help: false filter_html_nofollow: false weight: 11 settings: { } filter_align: id: filter_align provider: filter Loading @@ -30,15 +27,18 @@ filters: status: true weight: 8 settings: { } filter_html: id: filter_html provider: filter status: true weight: -10 settings: allowed_html: '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-entity-type data-entity-uuid data-align data-caption>' filter_html_help: false filter_html_nofollow: false filter_html_image_secure: id: filter_html_image_secure provider: filter status: true weight: 9 settings: { } editor_file_reference: id: editor_file_reference provider: editor status: true weight: 11 settings: { } core/modules/filter/config/install/filter.format.plain_text.yml +6 −9 Original line number Diff line number Diff line Loading @@ -9,14 +9,18 @@ name: 'Plain text' format: plain_text weight: 10 filters: # Escape all HTML. filter_autop: id: filter_autop provider: filter status: true weight: 0 settings: { } filter_html_escape: id: filter_html_escape provider: filter status: true weight: -10 settings: { } # Convert URLs into links. filter_url: id: filter_url provider: filter Loading @@ -24,10 +28,3 @@ filters: weight: 0 settings: filter_url_length: 72 # Convert linebreaks into paragraphs. filter_autop: id: filter_autop provider: filter status: true weight: 0 settings: { } core/modules/filter/config/schema/filter.schema.yml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ filter.format.*: label: 'Role' filters: type: sequence orderby: key label: 'Enabled filters' sequence: type: filter Loading core/modules/filter/filter.post_update.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php /** * @file * Post update functions for Filter. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\filter\Entity\FilterFormat; /** * Sorts filter format filter configuration. */ function filter_post_update_sort_filters(?array &$sandbox = NULL): void { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $config_entity_updater->update($sandbox, 'filter_format', function (FilterFormat $format): bool { $sorted_filters = $filters = array_keys($format->get('filters')); sort($sorted_filters); return $sorted_filters !== $filters; }); } core/modules/filter/src/Entity/FilterFormat.php +6 −3 Original line number Diff line number Diff line Loading @@ -202,10 +202,13 @@ public function disable() { * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { // Ensure the filters have been sorted before saving. $this->filters()->sort(); parent::preSave($storage); if (!$this->isSyncing() && $this->hasTrustedData()) { // Filters are sorted by keys to ensure config export diffs are easy to // read and there is a minimal changeset. If the save is not trusted then // the configuration will be sorted by StorableConfigBase. ksort($this->filters); } assert(is_string($this->label()), 'Filter format label is expected to be a string.'); $this->name = trim($this->label()); Loading Loading
core/modules/ckeditor5/tests/fixtures/ckeditor4_config/filter.format.basic_html.yml +14 −14 Original line number Diff line number Diff line Loading @@ -9,15 +9,12 @@ weight: 0 roles: - authenticated filters: filter_html: id: filter_html provider: filter editor_file_reference: id: editor_file_reference provider: editor status: true weight: -10 settings: allowed_html: '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-entity-type data-entity-uuid data-align data-caption>' filter_html_help: false filter_html_nofollow: false weight: 11 settings: { } filter_align: id: filter_align provider: filter Loading @@ -30,15 +27,18 @@ filters: status: true weight: 8 settings: { } filter_html: id: filter_html provider: filter status: true weight: -10 settings: allowed_html: '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <p> <br> <span> <img src alt height width data-entity-type data-entity-uuid data-align data-caption>' filter_html_help: false filter_html_nofollow: false filter_html_image_secure: id: filter_html_image_secure provider: filter status: true weight: 9 settings: { } editor_file_reference: id: editor_file_reference provider: editor status: true weight: 11 settings: { }
core/modules/filter/config/install/filter.format.plain_text.yml +6 −9 Original line number Diff line number Diff line Loading @@ -9,14 +9,18 @@ name: 'Plain text' format: plain_text weight: 10 filters: # Escape all HTML. filter_autop: id: filter_autop provider: filter status: true weight: 0 settings: { } filter_html_escape: id: filter_html_escape provider: filter status: true weight: -10 settings: { } # Convert URLs into links. filter_url: id: filter_url provider: filter Loading @@ -24,10 +28,3 @@ filters: weight: 0 settings: filter_url_length: 72 # Convert linebreaks into paragraphs. filter_autop: id: filter_autop provider: filter status: true weight: 0 settings: { }
core/modules/filter/config/schema/filter.schema.yml +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ filter.format.*: label: 'Role' filters: type: sequence orderby: key label: 'Enabled filters' sequence: type: filter Loading
core/modules/filter/filter.post_update.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php /** * @file * Post update functions for Filter. */ use Drupal\Core\Config\Entity\ConfigEntityUpdater; use Drupal\filter\Entity\FilterFormat; /** * Sorts filter format filter configuration. */ function filter_post_update_sort_filters(?array &$sandbox = NULL): void { $config_entity_updater = \Drupal::classResolver(ConfigEntityUpdater::class); $config_entity_updater->update($sandbox, 'filter_format', function (FilterFormat $format): bool { $sorted_filters = $filters = array_keys($format->get('filters')); sort($sorted_filters); return $sorted_filters !== $filters; }); }
core/modules/filter/src/Entity/FilterFormat.php +6 −3 Original line number Diff line number Diff line Loading @@ -202,10 +202,13 @@ public function disable() { * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { // Ensure the filters have been sorted before saving. $this->filters()->sort(); parent::preSave($storage); if (!$this->isSyncing() && $this->hasTrustedData()) { // Filters are sorted by keys to ensure config export diffs are easy to // read and there is a minimal changeset. If the save is not trusted then // the configuration will be sorted by StorableConfigBase. ksort($this->filters); } assert(is_string($this->label()), 'Filter format label is expected to be a string.'); $this->name = trim($this->label()); Loading