You are here

function field_group_requirements in Field Group 8.3

Implements hook_requirements().

File

./field_group.install, line 11
Update hooks for the Field Group module.

Code

function field_group_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {

    // Check jQuery UI Accordion module for D9.
    if (version_compare(\Drupal::VERSION, 9) > 0) {
      if (!\Drupal::moduleHandler()
        ->moduleExists('jquery_ui_accordion')) {
        $requirements['field_group_jquery_ui_accordion'] = [
          'title' => t('Field Group'),
          'value' => t('jQuery UI Accordion not enabled'),
          'description' => t('If you want to use the Field Group accordion formatter, you will need to install the <a href=":link" target="_blank">jQuery UI Accordion</a> module.', [
            ':link' => 'https://www.drupal.org/project/jquery_ui_accordion',
          ]),
          'severity' => REQUIREMENT_WARNING,
        ];
      }
      else {
        $requirements['field_group_jquery_ui_accordion'] = [
          'title' => t('Field Group'),
          'description' => t('The jQuery UI Accordion module is installed'),
          'severity' => REQUIREMENT_INFO,
        ];
      }
    }
  }
  return $requirements;
}