-
Notifications
You must be signed in to change notification settings - Fork 0
/
osu_story.install
37 lines (31 loc) · 1.49 KB
/
osu_story.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
<?php
use Drupal\Core\Config\FileStorage;
/**
* Add metatag for story.
*/
function osu_story_update_9001(&$sandbox) {
$install_path = Drupal::service('module_handler')
->getModule('osu_story')
->getPath();
$config_path = realpath($install_path . '/config/install');
$source = new FileStorage($config_path);
/** @var \Drupal\Core\Config\CachedStorage $config_storage */
$config_storage = \Drupal::service('config.storage');
$config_storage->write('metatag.metatag_defaults.node__story', $source->read('metatag.metatag_defaults.node__story'));
$config_storage->write('core.entity_view_display.node.story.teaser', $source->read('core.entity_view_display.node.story.teaser'));
return t('Add/updated the metatag defaults for OSU Story.');
}
/**
* Update the description of field_osu_story_external_url
*/
function osu_story_update_9002(&$sandbox) {
/** @var \Drupal\Core\Config\CachedStorage $config_storage */
$config_storage = \Drupal::service('config.storage');
// Load the field's existing configuration.
$field_config = $config_storage->read('field.field.node.story.field_osu_story_external_url');
// Update the description.
$field_config['description'] = 'Put a URL here if you want to link to story on another website and not write your own story.';
// Write the updated configuration back.
$config_storage->write('field.field.node.story.field_osu_story_external_url', $field_config);
return t('Updated the description of field_osu_story_external_url for OSU Story.');
}