DrupalViews.php in Advanced Insert View 2.0.x
File
modules/bueditor/src/Plugin/BUEditorPlugin/DrupalViews.php
View source
<?php
namespace Drupal\insert_view_adv_bueditor\Plugin\BUEditorPlugin;
use Drupal\editor\Entity\Editor;
use Drupal\bueditor\BUEditorPluginBase;
use Drupal\bueditor\Entity\BUEditorEditor;
use Drupal\bueditor\BUEditorToolbarWrapper;
class DrupalViews extends BUEditorPluginBase {
public function getButtons() {
return [
'drupalviews' => $this
->t('Views Embed'),
];
}
public function alterEditorJS(array &$js, BUEditorEditor $bueditor_editor, Editor $editor = NULL) {
$toolbar = BUEditorToolbarWrapper::set($js['settings']['toolbar']);
if ($toolbar
->has('drupalviews')) {
$js['libraries'][] = 'insert_view_adv_bueditor/drupalviews';
}
}
public function alterToolbarWidget(array &$widget) {
$widget['libraries'][] = 'insert_view_adv_bueditor/drupalviews';
}
}