You are here

bamboo_twig_extensions.install in Bamboo Twig 8.4

Contains install and update functions for Bamboo Twig Extensions.

File

bamboo_twig_extensions/bamboo_twig_extensions.install
View source
<?php

/**
 * @file
 * Contains install and update functions for Bamboo Twig Extensions.
 */

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

Functions