You are here

function bamboo_twig_extensions_requirements in Bamboo Twig 8.3

Same name and namespace in other branches
  1. 8.5 bamboo_twig_extensions/bamboo_twig_extensions.install \bamboo_twig_extensions_requirements()
  2. 8.2 bamboo_twig_extensions/bamboo_twig_extensions.install \bamboo_twig_extensions_requirements()
  3. 8.4 bamboo_twig_extensions/bamboo_twig_extensions.install \bamboo_twig_extensions_requirements()

Implements hook_requirements().

File

bamboo_twig_extensions/bamboo_twig_extensions.install, line 11
Contains install and update functions for Bamboo Twig Extensions.

Code

function bamboo_twig_extensions_requirements($phase) {
  $requirements = [];
  if ($phase == 'install') {
    if (!class_exists('Twig_Extensions_Extension_Array') || !class_exists('Twig_Extensions_Extension_Date') || !class_exists('Twig_Extensions_Extension_Text') || !function_exists('twig_truncate_filter') || !function_exists('twig_shuffle_filter')) {
      $requirements['twig_extensions_library'] = [
        'description' => t('Bamboo Twig Extensions requires the <a href=":twig-url">external Twig Extensions library</a>. The recommended way of solving this dependency is using <a href=":composer-url">Composer</a> running the following from the command line: <br /><code>composer require twig/extensions</code>.', [
          ':twig-url' => 'http://twig-extensions.readthedocs.io/en/latest/index.html',
          ':composer-url' => 'https://getcomposer.org',
        ]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}