public static function BUEditor::getBUEditorEditorId in BUEditor 8
Same name and namespace in other branches
- 8.2 src/Plugin/Editor/BUEditor.php \Drupal\bueditor\Plugin\Editor\BUEditor::getBUEditorEditorId()
Returns the selected BUEditor Editor id for an account from editor settings.
1 call to BUEditor::getBUEditorEditorId()
- BUEditor::getBUEditorEditor in src/
Plugin/ Editor/ BUEditor.php - Returns the selected BUEditor Editor entity for an account from editor settings.
File
- src/
Plugin/ Editor/ BUEditor.php, line 126
Class
- BUEditor
- Defines BUEditor as an Editor plugin.
Namespace
Drupal\bueditor\Plugin\EditorCode
public static function getBUEditorEditorId(Editor $editor, AccountInterface $account) {
$settings = $editor
->getSettings();
if (!empty($settings['roles_editors'])) {
// Filter roles in two steps. May avoid a db hit by filter_get_roles_by_format().
if ($roles_editors = array_intersect_key($settings['roles_editors'], array_flip($account
->getRoles()))) {
if ($roles_editors = array_intersect_key($roles_editors, filter_get_roles_by_format($editor
->getFilterFormat()))) {
return reset($roles_editors);
}
}
}
return $settings['default_editor'];
}