You are here

function gridstack_layout_alter in GridStack 8

Same name and namespace in other branches
  1. 8.2 gridstack.module \gridstack_layout_alter()

Implements hook_layout_alter().

File

./gridstack.module, line 57
Provides GridStack integration to have multi-column grids with drag-and-drop.

Code

function gridstack_layout_alter(&$definitions) {

  // Core and contrib layouts don't co-exist, safe to check for each presence.
  $handler = \Drupal::service('gridstack.manager')
    ->getModuleHandler();

  // This requires Drupal >= 8.x-3 with core layout_discovery.module.
  if ($handler
    ->moduleExists('layout_discovery')) {
    \Drupal\gridstack\Layout\GridStackLayout::layoutAlter($definitions);
  }
  elseif ($handler
    ->moduleExists('layout_plugin')) {
    \Drupal\gridstack\Layout\GridStackLayoutDeprecated::layoutAlter($definitions);
  }
}