function CKEditor4To5UpgradePluginManager::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem
Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists.
Generated by inspecting all \Drupal\ckeditor\CKEditorPluginButtonsInterface implementations.
Parameters
string $cke4_button: A valid CKEditor 4 button name.
\Drupal\ckeditor5\HTMLRestrictions $text_format_html_restrictions: The restrictions of the text format, to allow an upgrade plugin to inspect the text format's HTML restrictions to make a decision.
Return value
string[]|null The equivalent CKEditor 5 toolbar items, or NULL if no equivalent exists.
Throws
\OutOfBoundsException Thrown when no upgrade path exists.
\LogicException Thrown when a plugin claims to provide an upgrade path but does not.
See also
\Drupal\ckeditor\CKEditorPluginButtonsInterface
File
- 
              core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php, line 134  
Class
- CKEditor4To5UpgradePluginManager
 - Provides a CKEditor 4 to 5 upgrade plugin manager.
 
Namespace
Drupal\ckeditor5\PluginCode
public function mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem(string $cke4_button, HTMLRestrictions $text_format_html_restrictions) : ?array {
  $this->validateAndBuildMaps();
  if (!isset($this->cke4ButtonsMap[$cke4_button])) {
    throw new \OutOfBoundsException(sprintf('No upgrade path found for the "%s" button.', $cke4_button));
  }
  $plugin_id = $this->cke4ButtonsMap[$cke4_button];
  try {
    return $this->createInstance($plugin_id)
      ->mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem($cke4_button, $text_format_html_restrictions);
  } catch (\OutOfBoundsException $e) {
    throw new \LogicException(sprintf('The "%s" CKEditor4To5Upgrade plugin claims to provide an upgrade path for the "%s" CKEditor 4 button but does not.', $plugin_id, $cke4_button));
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.