You are here

public static function PrepareLayout::getSubscribedEvents in Layout builder library 8

File

src/EventSubscriber/PrepareLayout.php, line 40

Class

PrepareLayout
Alters a layout override to use layout library selection over the default.

Namespace

Drupal\layout_library\EventSubscriber

Code

public static function getSubscribedEvents() {

  // Only available in >= D9.1, see
  // https://www.drupal.org/project/layout_library/issues/3082434.
  if (class_exists('Drupal\\layout_builder\\Event\\PrepareLayoutEvent')) {

    // Priority higher than Layout Builder to interact first.
    $events[LayoutBuilderEvents::PREPARE_LAYOUT] = [
      'onPrepareLayout',
      20,
    ];
    return $events;
  }
  return [];
}