You are here

cpf.install in CPF 8

Same filename and directory in other branches
  1. 8.2 cpf.install

Installation actions for CPF.

File

cpf.install
View source
<?php

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

/**
 * Implments hook_requirements().
 */
function cpf_requirements($phase) {
  $requirements = [];

  // Check to see if the jQuery Mask Plugin library is available.
  if ($phase == 'runtime') {
    $library = libraries_detect('mask_plugin');
    if ($library && !empty($library['installed'])) {
      if ($library['version']) {
        $description = t('Version %i installed', [
          '%i' => $library['version'],
        ]);
      }
      else {
        $description = t('Unable to detect version.');
      }
      $requirements['mask_plugin'] = [
        'title' => t('jQuery Mask Plugin'),
        'description' => $description,
        'severity' => REQUIREMENT_OK,
      ];
    }
    else {
      $requirements['mask_plugin'] = [
        'title' => t('jQuery Mask Plugin'),
        'description' => t('jQuery Mask Plugin library not found. Please consult the README.md for installation instructions.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
cpf_requirements Implments hook_requirements().