You are here

protected function EmbedCKEditorPluginBase::getButton in Embed 8

Build the information about the specific button.

Parameters

\Drupal\embed\EmbedButtonInterface $embed_button: The embed button.

Return value

array The array for use with getButtons().

1 call to EmbedCKEditorPluginBase::getButton()
EmbedCKEditorPluginBase::getButtons in src/EmbedCKEditorPluginBase.php
Returns the buttons that this plugin provides, along with metadata.

File

src/EmbedCKEditorPluginBase.php, line 82

Class

EmbedCKEditorPluginBase
Provides a base class for embed CKEditor plugins.

Namespace

Drupal\embed

Code

protected function getButton(EmbedButtonInterface $embed_button) {
  $info = [
    'id' => $embed_button
      ->id(),
    'name' => Html::escape($embed_button
      ->label()),
    'label' => Html::escape($embed_button
      ->label()),
    'image' => $embed_button
      ->getIconUrl(),
  ];
  $definition = $this
    ->getPluginDefinition();
  if (!empty($definition['required_filter_plugin_id'])) {
    $info['required_filter_plugin_id'] = $definition['required_filter_plugin_id'];
  }
  return $info;
}