class Contrib

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Contrib
  2. 10 core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Contrib

Provides the CKEditor 4 to 5 upgrade path for contrib plugins now in core.

@CKEditor4To5Upgrade( id = "contrib", cke4_buttons = { "Code", "CodeSnippet", }, cke4_plugin_settings = { "codesnippet", }, cke5_plugin_elements_subset_configuration = { } )

@internal Plugin classes are internal.

Hierarchy

Expanded class hierarchy of Contrib

5 string references to 'Contrib'
LocaleTestDevelopmentReleaseHooks::localeTranslationProjectsAlter in core/modules/locale/tests/modules/locale_test_development_release/src/Hook/LocaleTestDevelopmentReleaseHooks.php
Implements hook_locale_translation_projects_alter().
locale_test_development_release_locale_translation_projects_alter in core/modules/locale/tests/modules/locale_test_development_release/locale_test_development_release.module
Implements hook_locale_translation_projects_alter().
UpdateHooks::pageTop in core/modules/update/src/Hook/UpdateHooks.php
Implements hook_page_top().
UpdateRequirements::runtime in core/modules/update/src/Hook/UpdateRequirements.php
Implements hook_runtime_requirements().
_update_cron_notify in core/modules/update/update.fetch.inc
Performs any notifications that should be done once cron fetches new data.

File

core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php, line 33

Namespace

Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade
View source
class Contrib extends PluginBase implements CKEditor4To5UpgradePluginInterface {
    
    /**
     * {@inheritdoc}
     */
    public function mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem(string $cke4_button, HTMLRestrictions $text_format_html_restrictions) : ?array {
        switch ($cke4_button) {
            // @see https://www.drupal.org/project/codetag
            case 'Code':
                return [
                    'code',
                ];
            // @see https://www.drupal.org/project/codesnippet
            case 'CodeSnippet':
                return [
                    'codeBlock',
                ];
            default:
                throw new \OutOfBoundsException();
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function mapCKEditor4SettingsToCKEditor5Configuration(string $cke4_plugin_id, array $cke4_plugin_settings) : ?array {
        switch ($cke4_plugin_id) {
            case 'codesnippet':
                $languages = [];
                $enabled_cke4_languages = array_filter($cke4_plugin_settings['highlight_languages']);
                foreach ($enabled_cke4_languages as $language) {
                    $languages[] = [
                        'language' => $language,
                        'label' => $language,
                    ];
                }
                return [
                    'ckeditor5_codeBlock' => [
                        'languages' => $languages,
                    ],
                ];
            default:
                throw new \OutOfBoundsException();
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function computeCKEditor5PluginSubsetConfiguration(string $cke5_plugin_id, FilterFormatInterface $text_format) : ?array {
        throw new \OutOfBoundsException();
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
Contrib::computeCKEditor5PluginSubsetConfiguration public function Computes elements subset configuration for CKEditor 5 plugin. Overrides CKEditor4To5UpgradePluginInterface::computeCKEditor5PluginSubsetConfiguration
Contrib::mapCKEditor4SettingsToCKEditor5Configuration public function Maps CKEditor 4 settings to the CKEditor 5 equivalent, if needed. Overrides CKEditor4To5UpgradePluginInterface::mapCKEditor4SettingsToCKEditor5Configuration
Contrib::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem public function Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists. Overrides CKEditor4To5UpgradePluginInterface::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 3
DependencySerializationTrait::__wakeup public function 3
MessengerTrait::$messenger protected property The messenger. 25
MessengerTrait::messenger public function Gets the messenger. 25
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin ID.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin ID of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable Deprecated public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 82
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language. 1

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