Skip to content
Snippets Groups Projects
Commit 3e578712 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2003616 by DmitryDrozdik, ebeyrent: Replace drupal_container() with...

Issue #2003616 by DmitryDrozdik, ebeyrent: Replace drupal_container() with Drupal::service() in the editor module.
parent 1cbc618c
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -132,7 +132,7 @@ function editor_form_filter_admin_overview_alter(&$form, $form_state) {
$form['formats']['#header'] = array_merge($start, $form['formats']['#header']);
// Then splice in the name of each text editor for each text format.
$editors = drupal_container()->get('plugin.manager.editor')->getDefinitions();
$editors = Drupal::service('plugin.manager.editor')->getDefinitions();
foreach (element_children($form['formats']) as $format_id) {
$editor = editor_load($format_id);
$editor_name = ($editor && isset($editors[$editor->editor])) ? $editors[$editor->editor]['label'] : drupal_placeholder('—');
......@@ -150,7 +150,7 @@ function editor_form_filter_admin_format_form_alter(&$form, &$form_state) {
if (!isset($form_state['editor'])) {
$format_id = $form['#format']->format;
$form_state['editor'] = editor_load($format_id);
$form_state['editor_manager'] = drupal_container()->get('plugin.manager.editor');
$form_state['editor_manager'] = Drupal::service('plugin.manager.editor');
}
$editor = $form_state['editor'];
$manager = $form_state['editor_manager'];
......@@ -345,7 +345,7 @@ function editor_pre_render_format($element) {
$element['#attached']['library'][] = array('editor', 'drupal.editor');
// Attach attachments for all available editors.
$manager = drupal_container()->get('plugin.manager.editor');
$manager = Drupal::service('plugin.manager.editor');
$element['#attached'] = NestedArray::mergeDeep($element['#attached'], $manager->getAttachments($format_ids));
return $element;
......
......@@ -74,7 +74,7 @@ public function label($langcode = NULL) {
public function __construct(array $values, $entity_type) {
parent::__construct($values, $entity_type);
$manager = drupal_container()->get('plugin.manager.editor');
$manager = \Drupal::service('plugin.manager.editor');
$plugin = $manager->createInstance($this->editor);
// Initialize settings, merging module-provided defaults.
......
......@@ -39,7 +39,7 @@ function isCompatible(FieldInstance $instance, array $items) {
elseif (!empty($instance['settings']['text_processing'])) {
$format_id = $items[0]['format'];
if (isset($format_id) && $editor = editor_load($format_id)) {
$definition = drupal_container()->get('plugin.manager.editor')->getDefinition($editor->editor);
$definition = \Drupal::service('plugin.manager.editor')->getDefinition($editor->editor);
if ($definition['supports_inline_editing'] === TRUE) {
return TRUE;
}
......@@ -73,7 +73,7 @@ public function getAttachments() {
global $user;
$user_format_ids = array_keys(filter_formats($user));
$manager = drupal_container()->get('plugin.manager.editor');
$manager = \Drupal::service('plugin.manager.editor');
$definitions = $manager->getDefinitions();
// Filter the current user's formats to those that support inline editing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment