You are here

function panelizer_requirements in Panelizer 8.5

Same name and namespace in other branches
  1. 6 panelizer.install \panelizer_requirements()
  2. 7.3 panelizer.install \panelizer_requirements()
  3. 7 panelizer.install \panelizer_requirements()
  4. 7.2 panelizer.install \panelizer_requirements()

Implements hook_requirements().

File

./panelizer.install, line 38
Install, update and uninstall functions for the Panelizer module.

Code

function panelizer_requirements($phase) {
  $requirements = [];
  if ($phase === 'update') {
    $available_modules = Drupal::service('extension.list.module')
      ->getAllAvailableInfo();
    if (!array_key_exists('layout_library', $available_modules)) {
      $requirements['panelizer_layout_library_not_installed'] = [
        'title' => t('Layout Library module required'),
        'description' => t('Panelizer 5.0 requires the <a href="@url">Layout builder library</a> module.', [
          '@url' => 'https://drupal.org/project/layout_library',
        ]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
    if (!array_key_exists('core_context', $available_modules)) {
      $requirements['panelizer_core_context_not_installed'] = [
        'title' => t('Core Context module required'),
        'description' => t('Panelizer 5.0 requires the <a href="@url">Core Context</a> module.', [
          '@url' => 'https://drpual.org/project/core_context',
        ]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}