Mercurial > hg > isophonics-drupal-site
comparison core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 /** | |
4 * @file | |
5 * Contains database additions to drupal-8.bare.standard.php.gz for testing the | |
6 * upgrade path of https://www.drupal.org/node/507488. | |
7 */ | |
8 | |
9 use Drupal\Core\Database\Database; | |
10 use Drupal\Core\Serialization\Yaml; | |
11 | |
12 $connection = Database::getConnection(); | |
13 | |
14 // Structure of a custom block with visibility settings. | |
15 $block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml')); | |
16 | |
17 foreach ($block_configs as $block_config) { | |
18 $connection->insert('config') | |
19 ->fields([ | |
20 'collection', | |
21 'name', | |
22 'data', | |
23 ]) | |
24 ->values([ | |
25 'collection' => '', | |
26 'name' => 'block.block.' . $block_config['id'], | |
27 'data' => serialize($block_config), | |
28 ]) | |
29 ->execute(); | |
30 } | |
31 | |
32 // Update the config entity query "index". | |
33 $existing_blocks = $connection->select('key_value') | |
34 ->fields('key_value', ['value']) | |
35 ->condition('collection', 'config.entity.key_store.block') | |
36 ->condition('name', 'theme:seven') | |
37 ->execute() | |
38 ->fetchField(); | |
39 $existing_blocks = unserialize($existing_blocks); | |
40 | |
41 $connection->update('key_value') | |
42 ->fields([ | |
43 'value' => serialize(array_merge($existing_blocks, ['block.block.seven_secondary_local_tasks'])) | |
44 ]) | |
45 ->condition('collection', 'config.entity.key_store.block') | |
46 ->condition('name', 'theme:seven') | |
47 ->execute(); |