Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / field / tests / fixtures / update / drupal-8.email_widget_size_setting-2578741.php
1 <?php
2
3 /**
4  * @file
5  * Contains SQL necessary to add a new component for an email field/widget to
6  * the 'node.article.default' entity form display.
7  */
8
9 use Drupal\Core\Database\Database;
10
11 $connection = Database::getConnection();
12
13 $config = $connection->select('config', 'c')
14   ->fields('c')
15   ->condition('collection', '')
16   ->condition('name', 'core.entity_form_display.node.article.default')
17   ->execute()
18   ->fetchAssoc();
19
20 $data = unserialize($config['data']);
21
22 // Manually add a new component that simulates an email field using the default
23 // email widget.
24 $data['content']['field_email_2578741'] = [
25   'weight' => 20,
26   'settings' => [
27     'placeholder' => '',
28   ],
29   'third_party_settings' => [],
30   'type' => 'email_default',
31 ];
32
33 $connection->update('config')
34   ->fields(['data' => serialize($data)])
35   ->condition('collection', '')
36   ->condition('name', 'core.entity_form_display.node.article.default')
37   ->execute();