-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultilingual_menu_urls.install
28 lines (26 loc) · 1.04 KB
/
multilingual_menu_urls.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
<?php
/**
* Implements hook_install().
*/
function multilingual_menu_urls_install() {
// Add Field Storage for Translated Link fields.
$entity_manager = \Drupal::entityManager();
$definition = $entity_manager->getFieldStorageDefinitions('menu_link_content')['translated_link_on'];
$entity_manager->onFieldStorageDefinitionCreate($definition);
$definition = $entity_manager->getFieldStorageDefinitions('menu_link_content')['translated_link_url'];
$entity_manager->onFieldStorageDefinitionCreate($definition);
}
/**
* Implements hook_uninstall().
*/
function multilingual_menu_urls_uninstall() {
$entity_manager = \Drupal::entityManager();
$definition = $entity_manager->getFieldStorageDefinitions('menu_link_content')['translated_link_on'];
if (!empty($definition)) {
$entity_manager->onFieldStorageDefinitionDelete($definition);
}
$definition = $entity_manager->getFieldStorageDefinitions('menu_link_content')['translated_link_url'];
if (!empty($definition)) {
$entity_manager->onFieldStorageDefinitionDelete($definition);
}
}