Commit 36972699 authored by webchick's avatar webchick

Issue #2014011 by kgoel | DmitryDrozdik: Replace drupal_container() with...

Issue #2014011 by kgoel | DmitryDrozdik: Replace drupal_container() with Drupal::service() in the shortcut module.
parent 7b9974f5
......@@ -31,7 +31,7 @@ function testShortcutLinkAdd() {
'source' => 'node/' . $this->node->nid,
'alias' => $this->randomName(8),
);
drupal_container()->get('path.crud')->save($path['source'], $path['alias']);
$this->container->get('path.crud')->save($path['source'], $path['alias']);
// Create some paths to test.
$test_cases = array(
......@@ -54,7 +54,7 @@ function testShortcutLinkAdd() {
$saved_set = shortcut_set_load($set->id());
$paths = $this->getShortcutInformation($saved_set, 'link_path');
$test_path = empty($test['path']) ? '<front>' : $test['path'];
$this->assertTrue(in_array(drupal_container()->get('path.alias_manager')->getSystemPath($test_path), $paths), 'Shortcut created: '. $test['path']);
$this->assertTrue(in_array($this->container->get('path.alias_manager')->getSystemPath($test_path), $paths), 'Shortcut created: '. $test['path']);
$this->assertLink($title, 0, 'Shortcut link found on the page.');
}
}
......
......@@ -372,7 +372,7 @@ function _shortcut_link_form_elements($shortcut_link = NULL) {
));
}
else {
$shortcut_link['link_path'] = ($shortcut_link['link_path'] == '<front>') ? '' : drupal_container()->get('path.alias_manager')->getPathAlias($shortcut_link['link_path']);
$shortcut_link['link_path'] = ($shortcut_link['link_path'] == '<front>') ? '' : Drupal::service('path.alias_manager')->getPathAlias($shortcut_link['link_path']);
}
$form['shortcut_link']['#tree'] = TRUE;
......@@ -419,7 +419,7 @@ function shortcut_link_edit_validate($form, &$form_state) {
*/
function shortcut_link_edit_submit($form, &$form_state) {
// Normalize the path in case it is an alias.
$shortcut_path = drupal_container()->get('path.alias_manager')->getSystemPath($form_state['values']['shortcut_link']['link_path']);
$shortcut_path = Drupal::service('path.alias_manager')->getSystemPath($form_state['values']['shortcut_link']['link_path']);
if (empty($shortcut_path)) {
$shortcut_path = '<front>';
}
......@@ -463,7 +463,7 @@ function shortcut_link_add_submit($form, &$form_state) {
*/
function shortcut_admin_add_link($shortcut_link, &$shortcut_set) {
// Normalize the path in case it is an alias.
$shortcut_link['link_path'] = drupal_container()->get('path.alias_manager')->getSystemPath($shortcut_link['link_path']);
$shortcut_link['link_path'] = Drupal::service('path.alias_manager')->getSystemPath($shortcut_link['link_path']);
if (empty($shortcut_link['link_path'])) {
$shortcut_link['link_path'] = '<front>';
}
......
......@@ -439,7 +439,7 @@ function shortcut_set_title_exists($title) {
*/
function shortcut_valid_link($path) {
// Do not use URL aliases.
$normal_path = drupal_container()->get('path.alias_manager')->getSystemPath($path);
$normal_path = Drupal::service('path.alias_manager')->getSystemPath($path);
if ($path != $normal_path) {
$path = $normal_path;
}
......
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