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) {
function aggregator_form_category_submit($form, &$form_state) {
// @todo Replicate this cache invalidation when these ops are separated.
// Invalidate the block cache to update aggregator category-based derivatives.
if (module_exists('block')) {
drupal_container()->get('plugin.manager.block')->clearCachedDefinitions();
if (Drupal::moduleHandler()->moduleExists('block')) {
Drupal::service('plugin.manager.block')->clearCachedDefinitions();
}
if ($form_state['values']['op'] == t('Delete')) {
$title = $form_state['values']['title'];
......
......@@ -345,7 +345,7 @@ function aggregator_save_category($edit) {
->condition('cid', $edit['cid'])
->execute();
// 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) {
$block->delete();
}
......@@ -365,7 +365,7 @@ function aggregator_save_category($edit) {
->execute();
$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']);
}
}
......
......@@ -209,7 +209,7 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr
*/
public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) {
// 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();
}
$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