You are here

function ds_extras_module_implements_alter in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 modules/ds_extras/ds_extras.module \ds_extras_module_implements_alter()
  2. 8.2 modules/ds_extras/ds_extras.module \ds_extras_module_implements_alter()
  3. 7.2 modules/ds_extras/ds_extras.module \ds_extras_module_implements_alter()
  4. 7 modules/ds_extras/ds_extras.module \ds_extras_module_implements_alter()

Implements hook_module_implements_alter().

File

modules/ds_extras/ds_extras.module, line 34
Display Suite extras main functions.

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 otherwise do nothing at all.
  // Region to block.
  $region_hooks = [
    'ds_layout_region_alter',
    'entity_view_alter',
  ];
  if (!\Drupal::config('ds_extras.settings')
    ->get('region_to_block') && in_array($hook, $region_hooks)) {
    unset($implementations['ds_extras']);
  }

  // Extra fields.
  $extra_fields_hooks = [
    'field_extra_fields',
  ];
  if (!\Drupal::config('ds_extras.settings')
    ->get('fields_extra') && in_array($hook, $extra_fields_hooks)) {
    unset($implementations['ds_extras']);
  }
}