You are here

function panopoly_widgets_field_default_field_instances_alter in Panopoly Widgets 7

Implements hook_field_default_field_instances_alter().

File

./panopoly_widgets.module, line 80

Code

function panopoly_widgets_field_default_field_instances_alter(&$instances) {

  // Set the file extensions from our configuration setting.
  if (isset($instances['fieldable_panels_pane-basic_file-field_basic_file_file'])) {
    $file_extensions = variable_get('panopoly_widgets_file_extensions', PANOPOLY_WIDGETS_FILE_EXTENSIONS_DEFAULT);
    $instances['fieldable_panels_pane-basic_file-field_basic_file_file']['settings']['file_extensions'] = $file_extensions;
  }

  // If the linkit module isn't present, then we alter the field settings for
  // the 'Add image' widget to disable linkit on the 'Link' field.
  if (isset($instances['fieldable_panels_pane-image-field_basic_image_link'])) {
    if (!module_exists('linkit')) {
      $instances['fieldable_panels_pane-image-field_basic_image_link']['settings']['linkit']['enable'] = 0;
      $instances['fieldable_panels_pane-image-field_basic_image_link']['settings']['linkit']['profile'] = NULL;
    }
  }
}