Issue #2003616 by DmitryDrozdik, ebeyrent: Replace drupal_container() with Drupal::service() in the editor module.

8.0.x
webchick 2013-06-17 01:39:17 -05:00
parent 1cbc618c34
commit 3e57871205
3 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -74,7 +74,7 @@ class Editor extends ConfigEntityBase implements EditorInterface {
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.

View File

@ -39,7 +39,7 @@ class Editor extends PluginBase implements EditPluginInterface {
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 @@ class Editor extends PluginBase implements EditPluginInterface {
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.