You are here

field_collection_table.install in Field Collection Table 7

Install, update and uninstall functions for the Field Collection Table module.

File

field_collection_table.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Field Collection Table module.
 */

/**
 * Implements hook_uninstall().
 */
function field_collection_table_uninstall() {
  variable_del('field_collection_table_format_form');
  variable_del('field_collection_table_hide_empty');
}

/**
 * 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']);
          }
          field_update_instance($instance);
        }
      }
    }
  }
}

Functions

Namesort descending Description
field_collection_table_uninstall Implements hook_uninstall().
field_collection_table_update_7001 Updates FCT Field Instances with new formatter settings.