Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / node / node.post_update.php
1 <?php
2
3 /**
4  * @file
5  * Post update functions for Node.
6  */
7
8 use Drupal\Core\Entity\Entity\EntityFormDisplay;
9
10 /**
11 * Load all form displays for nodes, add status with these settings, save.
12 */
13 function node_post_update_configure_status_field_widget() {
14   $query = \Drupal::entityQuery('entity_form_display')->condition('targetEntityType', 'node');
15   $ids = $query->execute();
16   $form_displays = EntityFormDisplay::loadMultiple($ids);
17
18   // Assign status settings for each 'node' target entity types with 'default'
19   // form mode.
20   foreach ($form_displays as $id => $form_display) {
21     /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $form_display */
22     $form_display->setComponent('status', [
23       'type' => 'boolean_checkbox',
24       'settings' => [
25         'display_label' => TRUE,
26       ],
27     ])->save();
28   }
29 }