You are here

function _ds_extras_module_implements_alter in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.registry.inc \_ds_extras_module_implements_alter()

Implements hook_module_implements_alter().

1 call to _ds_extras_module_implements_alter()
ds_extras_module_implements_alter in modules/ds_extras/ds_extras.module
Implements hook_module_implements_alter().

File

modules/ds_extras/ds_extras.registry.inc, line 192
Display suite Extras registry file.

Code

function _ds_extras_module_implements_alter(&$implementations, $hook) {

  // Because it's possible to turn on/off features for DS extras,
  // we'll unset hooks here if necessary which otherwhise do nothing at all.
  // Field template
  $ft_hooks = array(
    'ds_field_settings_alter',
    'form_ds_styles_form_alter',
    'form_field_ui_field_edit_form_alter',
    'theme',
  );
  if (!variable_get('ds_extras_field_template', FALSE) && in_array($hook, $ft_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Contextual
  $con_hooks = array(
    'contextual_links_view_alter',
    'admin_paths',
  );
  if (!variable_get('ds_extras_contextual', FALSE) && in_array($hook, $con_hooks)) {
    if (!module_exists('field_ui')) {
      unset($implementations['ds_extras']);
    }
  }

  // Region to block
  $region_hooks = array(
    'ds_layout_region_alter',
    'field_attach_view_alter',
    'block_info',
    'block_view',
  );
  if (!variable_get('ds_extras_region_to_block', FALSE) && in_array($hook, $region_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Switch view mode
  $switch_hooks = array(
    'permission',
    'form_node_form_alter',
  );
  if (!variable_get('ds_extras_switch_view_mode', FALSE) && in_array($hook, $switch_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Revision view mode.
  $revision_hooks = array(
    'entity_info_alter',
  );
  if (!variable_get('ds_extras_revision_view_mode', FALSE) && in_array($hook, $revision_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Views displays
  $vd_hooks = array(
    'entity_info',
    'ctools_plugin_api',
    'ds_fields_ui_alter',
  );
  if (!variable_get('ds_extras_vd', FALSE) && in_array($hook, $vd_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Panel view modes.
  $pvm_hooks = array(
    'flush_caches',
    'panels_dashboard_blocks',
    'ds_panels_default_fields',
    'entity_update',
    'entity_delete',
    'ctools_plugin_directory',
    'ctools_plugin_type',
  );
  if (!variable_get('ds_extras_panel_view_modes', FALSE) && in_array($hook, $pvm_hooks)) {
    unset($implementations['ds_extras']);
  }
}