outlayer-8.x-1.4/outlayer.install

outlayer.install
<?php

/**
 * @file
 * Installation actions for Outlayer.
 */

/**
 * Implements hook_requirements().
 */
function outlayer_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }

  $requirements = [];

  // Outlayer library.
  $libs = ['isotope', 'isotope-layout'];
  if ($check = blazy()->getLibrariesPath($libs)) {
    $path = $check;
  }
  else {
    $path = \Drupal::root() . '/libraries/isotope';
    if (!is_file($path . '/dist/isotope.pkgd.min.js')) {
      $path = \Drupal::root() . '/libraries/isotope-layout';
    }
  }

  $exists = FALSE;
  if ($path && is_dir($path)) {
    $exists = is_file($path . '/dist/isotope.pkgd.min.js');
  }

  $requirements['isotope_library'] = [
    'title'       => t('Isotope library'),
    'description' => $exists ? '' : t('The <a href=":url">Isotope library</a> should be installed at <strong>/libraries/isotope/dist/isotope.pkgd.min.js</strong>, or any path supported by libraries.module if installed. Check out file or folder permissions if troubled.', [':url' => 'https://github.com/metafizzy/isotope']),
    'severity'    => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    'value'       => $exists ? t('Installed') : t('Not installed'),
  ];

  return $requirements;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc