You are here

function select2widget_requirements in Select2 Field Widget 7.2

Same name and namespace in other branches
  1. 7 select2widget.install \select2widget_requirements()

Implements hook_requirements().

File

./select2widget.install, line 11
Install, uninstall, and requirements operations.

Code

function select2widget_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    module_load_include('module', 'libraries');
    $available = libraries_get_path('select2');
    $t = get_t();
    $requirements = array(
      'select2widget_library' => array(
        'title' => $t('Select2'),
        'value' => $available ? $t('Library is available') : $t('Library is missing'),
        'description' => $available ? NULL : $t('Please download the Select2 library into "sites/all/libraries" or any alternative path that is supported by the libraries module.'),
        'severity' => $available ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      ),
    );
  }
  return $requirements;
}