-
Notifications
You must be signed in to change notification settings - Fork 5
/
commerce_shipping_pickup_extra.install
42 lines (37 loc) · 1.14 KB
/
commerce_shipping_pickup_extra.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Implements hook_update_N().
*/
function commerce_shipping_pickup_extra_update_8001(&$sandbox) {
\Drupal::entityTypeManager()->clearCachedDefinitions();
\Drupal::entityDefinitionUpdateManager()
->installEntityType(\Drupal::entityTypeManager()
->getDefinition('pickup_item'));
}
/**
* Implements hook_update_N().
*/
function commerce_shipping_pickup_extra_update_8002(&$sandbox) {
$um = \Drupal::entityDefinitionUpdateManager();
$storage_definition = BaseFieldDefinition::create('string')
->setLabel(t('Name with address'))
->setSettings([
'max_length' => 255,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$um->installFieldStorageDefinition('name_with_address', 'pickup_item', 'pickup_item', $storage_definition);
}