Mercurial > hg > isophonics-drupal-site
comparison core/modules/layout_builder/layout_builder.post_update.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Post update functions for Layout Builder. | |
6 */ | |
7 | |
8 /** | |
9 * Rebuild plugin dependencies for all entity view displays. | |
10 */ | |
11 function layout_builder_post_update_rebuild_plugin_dependencies(&$sandbox = NULL) { | |
12 $storage = \Drupal::entityTypeManager()->getStorage('entity_view_display'); | |
13 if (!isset($sandbox['ids'])) { | |
14 $sandbox['ids'] = $storage->getQuery()->accessCheck(FALSE)->execute(); | |
15 $sandbox['count'] = count($sandbox['ids']); | |
16 } | |
17 | |
18 for ($i = 0; $i < 10 && count($sandbox['ids']); $i++) { | |
19 $id = array_shift($sandbox['ids']); | |
20 if ($display = $storage->load($id)) { | |
21 $display->save(); | |
22 } | |
23 } | |
24 | |
25 $sandbox['#finished'] = empty($sandbox['ids']) ? 1 : ($sandbox['count'] - count($sandbox['ids'])) / $sandbox['count']; | |
26 } |