1 ckeditor5.install ckeditor5_requirements($phase)

Implements hook_requirements().

File

core/modules/ckeditor5/ckeditor5.install, line 10
Install, update and uninstall functions for CKEditor module.

Code

function ckeditor5_requirements($phase) {
  $requirements = array();
  $t = get_t();

  if ($phase == 'runtime') {
    $requirements['ckeditor5_version'] = array(
      'title' => $t('CKEditor 5'),
      'value' => $t('Version: !version', array('!version' => CKEDITOR5_VERSION)),
      'severity' => REQUIREMENT_INFO,
    );

    // Check if CKEditor is not enabled on any formats.
    $ckeditor5_found = FALSE;
    $formats = filter_formats();
    foreach ($formats as $format) {
      if (isset($format->editor) && $format->editor === 'ckeditor5') {
        $ckeditor5_found = TRUE;
      }
    }
    if (!$ckeditor5_found) {
      $requirements['ckeditor5_not_enabled'] = array(
        'title' => $t('CKEditor 5'),
        'value' => $t('CKEditor 5 is installed but not added to any text formats. Visit the <a href="!url">text editors and formats configuration</a> to add CKEditor 5 to one or more formats.', array(
          '!url' => url('admin/config/content/formats'),
        )),
        'severity' => REQUIREMENT_WARNING,
      );
    }
  }

  return $requirements;
}