function CKEditor5StylesheetsMessage::checkForStylesheetsEquivalent

Same name in other branches
  1. 9 core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php \Drupal\ckeditor5\CKEditor5StylesheetsMessage::checkForStylesheetsEquivalent()
  2. 11.x core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php \Drupal\ckeditor5\CKEditor5StylesheetsMessage::checkForStylesheetsEquivalent()

Checks themes using ckeditor_stylesheets for CKEditor 5 equivalents.

Parameters

array $theme_info: The config of the theme to check.

string[] $ckeditor_stylesheets_use: Themes using ckeditor_stylesheets without a CKEditor 5 equivalent.

1 call to CKEditor5StylesheetsMessage::checkForStylesheetsEquivalent()
CKEditor5StylesheetsMessage::getWarning in core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php
Generates a warning related to ckeditor_stylesheets.

File

core/modules/ckeditor5/src/CKEditor5StylesheetsMessage.php, line 109

Class

CKEditor5StylesheetsMessage
Messaging for themes using the ckeditor_stylesheets setting.

Namespace

Drupal\ckeditor5

Code

private function checkForStylesheetsEquivalent(array $theme_info, array &$ckeditor_stylesheets_use) {
    $theme_has_ckeditor5_stylesheets = isset($theme_info['ckeditor5-stylesheets']);
    if (!empty($theme_info['ckeditor_stylesheets']) && !$theme_has_ckeditor5_stylesheets) {
        $ckeditor_stylesheets_use[] = $theme_info['name'];
    }
    // If the primary theme has ckeditor5-stylesheets configured, do not check
    // base themes. The primary theme can potentially provide the
    // ckeditor5-stylesheets config for itself and its base themes, so we err
    // on the side of not showing a warning if this is possibly the case.
    if ($theme_has_ckeditor5_stylesheets) {
        return;
    }
    $base_theme = $theme_info['base theme'] ?? FALSE;
    while ($base_theme) {
        $base_theme_info = $this->themeHandler
            ->listInfo()[$base_theme]->info;
        $base_theme_has_ckeditor5_stylesheets = isset($base_theme_info['ckeditor5-stylesheets']);
        if (!empty($base_theme_info['ckeditor_stylesheets']) && !$base_theme_has_ckeditor5_stylesheets) {
            $ckeditor_stylesheets_use[] = $base_theme_info['name'];
        }
        $base_theme = $base_theme_info['base theme'] ?? FALSE;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.