comparison core/modules/editor/editor.install @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 /**
4 * @file
5 * Install, update and uninstall functions for the Editor module.
6 */
7
8 /**
9 * Synchronizes the editor status with the paired text format status.
10 */
11 function editor_update_8001() {
12 $config_factory = \Drupal::configFactory();
13 // Iterate on all text formats config entities.
14 foreach ($config_factory->listAll('filter.format.') as $name) {
15 list(,, $id) = explode('.', $name, 3);
16 $status = $config_factory->get($name)->get('status');
17 $editor = $config_factory->getEditable("editor.editor.$id");
18 if (!$editor->isNew() && $editor->get('status') !== $status) {
19 $editor->set('status', $status)->save();
20 }
21 }
22 }