public function XPreview::validateEditorForm in BUEditor 8
Same name and namespace in other branches
- 8.2 src/Plugin/BUEditorPlugin/XPreview.php \Drupal\bueditor\Plugin\BUEditorPlugin\XPreview::validateEditorForm()
Validates entity form of a BUEditor Editor.
Overrides BUEditorPluginBase::validateEditorForm
File
- src/
Plugin/ BUEditorPlugin/ XPreview.php, line 61
Class
- XPreview
- Defines BUEditor Ajax Preview plugin.
Namespace
Drupal\bueditor\Plugin\BUEditorPluginCode
public function validateEditorForm(array &$form, FormStateInterface $form_state, BUEditorEditor $bueditor_editor) {
// Warn about XPreview permission if it is newly activated.
if (!$form_state
->getErrors()) {
if ($bueditor_editor
->hasToolbarItem('xpreview')) {
$ori = $bueditor_editor
->isNew() ? NULL : $bueditor_editor
->load($bueditor_editor
->id());
if (!$ori || !$ori
->hasToolbarItem('xpreview')) {
$msg = $this
->t('Ajax preview button has been enabled. Please check <a href="@url">the required permissions</a>.', [
'@url' => Url::fromRoute('user.admin_permissions')
->toString(),
]);
$this
->messenger()
->addMessage($msg);
}
}
}
}