Commit 16c9b52d authored by alexpott's avatar alexpott

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

Issue #2001202 by DmitryDrozdik, ebeyrent: Replace drupal_container() with Drupal::service() in the aggregator module.
parent 4e7abeed
...@@ -73,8 +73,8 @@ function aggregator_form_category_validate($form, &$form_state) { ...@@ -73,8 +73,8 @@ function aggregator_form_category_validate($form, &$form_state) {
function aggregator_form_category_submit($form, &$form_state) { function aggregator_form_category_submit($form, &$form_state) {
// @todo Replicate this cache invalidation when these ops are separated. // @todo Replicate this cache invalidation when these ops are separated.
// Invalidate the block cache to update aggregator category-based derivatives. // Invalidate the block cache to update aggregator category-based derivatives.
if (module_exists('block')) { if (Drupal::moduleHandler()->moduleExists('block')) {
drupal_container()->get('plugin.manager.block')->clearCachedDefinitions(); Drupal::service('plugin.manager.block')->clearCachedDefinitions();
} }
if ($form_state['values']['op'] == t('Delete')) { if ($form_state['values']['op'] == t('Delete')) {
$title = $form_state['values']['title']; $title = $form_state['values']['title'];
......
...@@ -345,7 +345,7 @@ function aggregator_save_category($edit) { ...@@ -345,7 +345,7 @@ function aggregator_save_category($edit) {
->condition('cid', $edit['cid']) ->condition('cid', $edit['cid'])
->execute(); ->execute();
// Make sure there is no active block for this category. // Make sure there is no active block for this category.
if (module_exists('block')) { if (Drupal::moduleHandler()->moduleExists('block')) {
foreach (entity_load_multiple_by_properties('block', array('plugin' => 'aggregator_category_block:' . $edit['cid'])) as $block) { foreach (entity_load_multiple_by_properties('block', array('plugin' => 'aggregator_category_block:' . $edit['cid'])) as $block) {
$block->delete(); $block->delete();
} }
...@@ -365,7 +365,7 @@ function aggregator_save_category($edit) { ...@@ -365,7 +365,7 @@ function aggregator_save_category($edit) {
->execute(); ->execute();
$op = 'insert'; $op = 'insert';
} }
if (isset($op) && module_exists('menu_link')) { if (isset($op) && Drupal::moduleHandler()->moduleExists('menu_link')) {
menu_link_maintain('aggregator', $op, $link_path, $edit['title']); menu_link_maintain('aggregator', $op, $link_path, $edit['title']);
} }
} }
......
...@@ -209,7 +209,7 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr ...@@ -209,7 +209,7 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr
*/ */
public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) { public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
// Invalidate the block cache to update aggregator feed-based derivatives. // Invalidate the block cache to update aggregator feed-based derivatives.
if (module_exists('block')) { if (\Drupal::moduleHandler()->moduleExists('block')) {
\Drupal::service('plugin.manager.block')->clearCachedDefinitions(); \Drupal::service('plugin.manager.block')->clearCachedDefinitions();
} }
$storage_controller->deleteCategories($entities); $storage_controller->deleteCategories($entities);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment