You are here

function a11y_paragraphs_tabs_requirements in A11Y Paragraphs Tabs 8

Implements hook_requirements().

File

./a11y_paragraphs_tabs.install, line 11
Installation actions for A11Y Paragraphs Tabs Component.

Code

function a11y_paragraphs_tabs_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  if (function_exists('libraries_get_path')) {
    $path = libraries_get_path('a11y-accordion-tabs') . '/a11y-accordion-tabs.js';
  }
  else {
    $path = DRUPAL_ROOT . '/libraries/a11y-accordion-tabs/a11y-accordion-tabs.js';
  }
  $exists = is_file($path);
  return [
    'accordion_library' => [
      'title' => t('A11Y Accordion Tabs library'),
      'description' => $exists ? '' : t('The <a href=":url">A11Y Accordion Tabs library</a> should be installed at <strong>/libraries/a11y-accordion-tabs/a11y-accordion-tabs.js</strong>, or any path supported by libraries.module if installed.', [
        ':url' => 'https://github.com/matthiasott/a11y-accordion-tabs',
      ]),
      'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'value' => $exists ? t('Installed') : t('Not installed'),
    ],
  ];
}