Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/node/node.post_update.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
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 } |