function LanguagePluginTest::buildExpectedDynamicConfig

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/tests/src/Unit/LanguagePluginTest.php \Drupal\Tests\ckeditor5\Unit\LanguagePluginTest::buildExpectedDynamicConfig()
  2. 11.x core/modules/ckeditor5/tests/src/Unit/LanguagePluginTest.php \Drupal\Tests\ckeditor5\Unit\LanguagePluginTest::buildExpectedDynamicConfig()

Builds the expected dynamic configuration output given a language list.

Parameters

array $language_list: The languages list from the language manager.

Return value

array The expected output of the dynamic plugin configuration.

1 call to LanguagePluginTest::buildExpectedDynamicConfig()
LanguagePluginTest::providerGetDynamicPluginConfig in core/modules/ckeditor5/tests/src/Unit/LanguagePluginTest.php
Provides a list of configs to test.

File

core/modules/ckeditor5/tests/src/Unit/LanguagePluginTest.php, line 105

Class

LanguagePluginTest
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language[[api-linebreak]] @group ckeditor5 @internal

Namespace

Drupal\Tests\ckeditor5\Unit

Code

protected static function buildExpectedDynamicConfig(array $language_list) {
  $expected_language_config = [];
  foreach ($language_list as $language_code => $language_list_item) {
    $item = [
      'title' => $language_list_item[0],
      'languageCode' => $language_code,
    ];
    if (isset($language_list_item[2])) {
      $item['textDirection'] = $language_list_item[2];
    }
    $expected_language_config[$item['title']] = $item;
  }
  ksort($expected_language_config);
  return array_values($expected_language_config);
}

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