-
Notifications
You must be signed in to change notification settings - Fork 1
/
field_collection_table.install
33 lines (30 loc) · 1.14 KB
/
field_collection_table.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
<?php
/**
* @file
* Install, update and uninstall functions for the Field Collection Table module.
*/
/**
* Implements hook_uninstall().
*/
function field_collection_table_uninstall() {
\Drupal::configFactory()->getEditable('field_collection_table.settings')->clear('field_collection_table_format_form')->save();
\Drupal::configFactory()->getEditable('field_collection_table.settings')->clear('field_collection_table_hide_empty')->save();
}
/**
* Updates FCT Field Instances with new formatter settings.
*/
function field_collection_table_update_7001() {
foreach (field_info_instances() as $entity_type => $entity) {
foreach ($entity as $entity_name => $info) {
foreach ($info as $field_name => $instance) {
if (!empty($instance['widget']['type']) && $instance['widget']['type'] == 'field_collection_table') {
if (isset($instance['widget']['settings']['title_on_top'])) {
$instance['widget']['settings']['hide_title'] = !$instance['widget']['settings']['title_on_top'];
unset($instance['widget']['settings']['title_on_top']);
}
$instance->save();
}
}
}
}
}