field_collection_table_d8-8.x-1.x-dev/field_collection_table.install
field_collection_table.install
<?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();
}
}
}
}
}
