You are here

function farm_update_7000 in farmOS 7

Enable the Farm Fields module.

File

./farm.install, line 286
farmOS install file.

Code

function farm_update_7000(&$sandbox) {

  // Install the farm_fields module and revert the field_base component on it,
  // so that they are available to update hooks in other modules.
  //
  // Between farmOS 7.x-1.0-beta2 and 7.x-1.0-beta3, we upgraded from
  // Features 1.x to 2.x. This replaced the 'field' component with
  // 'field_base' and 'field_instance'. At the same time, a new module was
  // introduced, to serve as a place to put common field_bases: farm_fields.
  if (!module_exists('farm_fields')) {

    // Enable the farm_fields module.
    module_enable(array(
      'farm_fields',
    ));

    // Reset the "default_hook" static cache for field_base Features components.
    module_load_include('inc', 'features', 'features.export');
    features_get_default_hooks('field_base', TRUE);

    // Load the farm_fields field_base Features include file, otherwise
    // feature_get_default() will not see it, and the revert will fail.
    module_load_include('inc', 'farm_fields', 'farm_fields.features.field_base');

    // Revert the field_base component of farm_fields.
    features_revert(array(
      'farm_fields' => array(
        'field_base',
      ),
    ));
  }
}