You are here

class DrupalViews in Advanced Insert View 8

Same name and namespace in other branches
  1. 2.0.x modules/bueditor/src/Plugin/BUEditorPlugin/DrupalViews.php \Drupal\insert_view_adv_bueditor\Plugin\BUEditorPlugin\DrupalViews

Defines BUEditor Embedded Views plugin.

Plugin annotation


@BUEditorPlugin(
  id = "drupalviews",
  label = "Embedded Views"
)

Hierarchy

  • class \Drupal\insert_view_adv_bueditor\Plugin\BUEditorPlugin\DrupalViews extends \Drupal\bueditor\BUEditorPluginBase

Expanded class hierarchy of DrupalViews

File

modules/bueditor/src/Plugin/BUEditorPlugin/DrupalViews.php, line 19

Namespace

Drupal\insert_view_adv_bueditor\Plugin\BUEditorPlugin
View source
class DrupalViews extends BUEditorPluginBase {

  /**
   * {@inheritdoc}
   */
  public function getButtons() {
    return [
      'drupalviews' => $this
        ->t('Views Embed'),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function alterEditorJS(array &$js, BUEditorEditor $bueditor_editor, Editor $editor = NULL) {
    $toolbar = BUEditorToolbarWrapper::set($js['settings']['toolbar']);

    // Check drupal views button.
    if ($toolbar
      ->has('drupalviews')) {
      $js['libraries'][] = 'insert_view_adv_bueditor/drupalviews';
    }
  }

  /**
   * {@inheritdoc}
   */
  public function alterToolbarWidget(array &$widget) {

    // Make  drupalviews definition available to toolbar widget
    $widget['libraries'][] = 'insert_view_adv_bueditor/drupalviews';
  }

}

Members