As mentioned at #2852557: Config export key order is not predictable, use config schema to order keys for maps, config export ordering isn't predictable. \Drupal\filter\Entity\FilterFormat
attempts to order filters at \Drupal\filter\Entity\FilterFormat::filters()
and \Drupal\filter\Entity\FilterFormat::preSave()
, but those methods only update the order of filters inside of the FilterPluginCollection, and not the $filters
property on FilterFormat. This can lead to config that is not imported cleanly, and it's especially noticable when moving config across sites or with config_split.
Since processing of filtered text relies on the in-array order of the filters and doesn't sort by weight first, let's ensure filters are consistently sorted when saving the config entity.