core/modules/filter/config/schema/filter.schema.yml | 2 +- core/modules/filter/src/FilterFormatFormBase.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/modules/filter/config/schema/filter.schema.yml b/core/modules/filter/config/schema/filter.schema.yml index 4040ec4837..d96c19a1b1 100644 --- a/core/modules/filter/config/schema/filter.schema.yml +++ b/core/modules/filter/config/schema/filter.schema.yml @@ -27,7 +27,7 @@ filter.format.*: roles: type: sequence label: 'Roles' - deprecated: "The 'roles' property of text formats is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3168851." + deprecated: "The 'roles' property of text formats is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3168851." sequence: type: string label: 'Role' diff --git a/core/modules/filter/src/FilterFormatFormBase.php b/core/modules/filter/src/FilterFormatFormBase.php index 060c21e520..60a3c7d857 100644 --- a/core/modules/filter/src/FilterFormatFormBase.php +++ b/core/modules/filter/src/FilterFormatFormBase.php @@ -174,12 +174,17 @@ public function exists($format_id) { */ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) { // Avoid setting the roles as a property of the text format. - $entity->set('name', $form_state->getValue('name')); - $entity->set('format', $form_state->getValue('format')); + $roles = $form_state->getValue('roles'); + $form_state->unsetValue('roles'); + parent::copyFormValuesToEntity($entity, $form, $form_state); foreach ($form_state->getValue('filters') as $instance_id => $config) { $entity->setFilterConfig($instance_id, $config); } + + // Restore roles form value to allow saving user permissions later. + // @see ::save() + $form_state->setValue('roles', $roles); } /**