You are here

function permissions_by_term_requirements in Permissions by Term 8.2

Implements hook_requirements().

File

./permissions_by_term.install, line 80
Install, update and uninstall functions for the permissions_by_term module.

Code

function permissions_by_term_requirements(string $phase) {
  $requirements = [];
  if ($phase === 'update' || $phase === 'runtime') {
    if (!\Drupal::moduleHandler()
      ->moduleExists('dynamic_page_cache')) {
      $requirements['permissions_by_term_dynamic_page_cache_missing'] = [
        'severity' => REQUIREMENT_WARNING,
        'title' => t('Permissions by Term: dynamic page cache is not installed.'),
        'description' => t('The "Internal Dynamic Page Cache" module must be installed. Otherwise there cannot be run any permission check for your views pages. Ensure having the dynamic page cache module and page cache module installed.'),
        'value' => t('No dynamic page cache'),
      ];
    }
    if (!\Drupal::moduleHandler()
      ->moduleExists('page_cache')) {
      $requirements['permissions_by_term_page_cache_missing'] = [
        'severity' => REQUIREMENT_WARNING,
        'title' => t('Permissions by Term: page cache module is not installed.'),
        'description' => t("The 'Page Cache' module is not installed. Without this module your site's performance will be slow. Ensure having the dynamic page cache module and page cache module installed."),
        'value' => t('No page cache'),
      ];
    }
  }
  return $requirements;
}