You are here

a11y_paragraphs_tabs.install in A11Y Paragraphs Tabs 8

Installation actions for A11Y Paragraphs Tabs Component.

File

a11y_paragraphs_tabs.install
View source
<?php

/**
 * @file
 * Installation actions for A11Y Paragraphs Tabs Component.
 */

/**
 * Implements hook_requirements().
 */
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'),
    ],
  ];
}

Functions