Commit bfcdcd40 authored by webchick's avatar webchick

Issue #2011102 by kgoel, DmitryDrozdik: Replace drupal_container() with...

Issue #2011102 by kgoel, DmitryDrozdik: Replace drupal_container() with Drupal::service() in the locale module.
parent 2afb8252
......@@ -110,13 +110,13 @@ function testPathLanguageConfiguration() {
'alias' => $custom_path,
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
);
drupal_container()->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
$lookup_path = drupal_container()->get('path.alias_manager')->getPathAlias('node/' . $node->nid, 'en');
$this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
$lookup_path = $this->container->get('path.alias_manager')->getPathAlias('node/' . $node->nid, 'en');
$this->assertEqual($english_path, $lookup_path, t('English language alias has priority.'));
// Same check for language 'xx'.
$lookup_path = drupal_container()->get('path.alias_manager')->getPathAlias('node/' . $node->nid, $prefix);
$lookup_path = $this->container->get('path.alias_manager')->getPathAlias('node/' . $node->nid, $prefix);
$this->assertEqual($custom_language_path, $lookup_path, t('Custom language alias has priority.'));
drupal_container()->get('path.crud')->delete($edit);
$this->container->get('path.crud')->delete($edit);
// Create language nodes to check priority of aliases.
$first_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
......@@ -128,7 +128,7 @@ function testPathLanguageConfiguration() {
'alias' => $custom_path,
'langcode' => 'en',
);
drupal_container()->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
$this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
// Assign a custom path alias to second node with Language::LANGCODE_NOT_SPECIFIED.
$edit = array(
......@@ -136,7 +136,7 @@ function testPathLanguageConfiguration() {
'alias' => $custom_path,
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
);
drupal_container()->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
$this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']);
// Test that both node titles link to our path alias.
$this->drupalGet('<front>');
......
......@@ -176,7 +176,7 @@ function locale_translation_batch_status_finished($success, $results) {
$t = get_t();
if ($success) {
if (isset($results['failed_files'])) {
if (module_exists('dblog')) {
if (Drupal::moduleHandler()->moduleExists('dblog')) {
$message = format_plural(count($results['failed_files']), 'One translation file could not be checked. <a href="@url">See the log</a> for details.', '@count translation files could not be checked. <a href="@url">See the log</a> for details.', array('@url' => url('admin/reports/dblog')));
}
else {
......
......@@ -634,7 +634,7 @@ function locale_translate_batch_finished($success, $results) {
watchdog('locale', 'Translations imported: %number added, %update updated, %delete removed.', array('%number' => $additions, '%update' => $updates, '%delete' => $deletes));
if ($skips) {
if (module_exists('dblog')) {
if (Drupal::moduleHandler()->moduleExists('dblog')) {
$message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', array('@url' => url('admin/reports/dblog')));
}
else {
......
......@@ -46,7 +46,7 @@ function locale_translation_flush_projects() {
*/
function locale_translation_build_projects() {
// This function depends on Update module. We degrade gracefully.
if (!module_exists('update')) {
if (!Drupal::moduleHandler()->moduleExists('update')) {
return array();
}
......@@ -132,7 +132,7 @@ function locale_translation_build_projects() {
*/
function locale_translation_project_list() {
// This function depends on Update module. We degrade gracefully.
if (!module_exists('update')) {
if (!Drupal::moduleHandler()->moduleExists('update')) {
return array();
}
......
......@@ -58,7 +58,7 @@ function locale_translation_get_projects($project_names = array()) {
// http://drupal.org/node/1777106 is a follow-up issue to make the check for
// possible out-of-date project information more robust.
if ($result->rowCount() == 0 && module_exists('update')) {
if ($result->rowCount() == 0 && Drupal::moduleHandler()->moduleExists('update')) {
module_load_include('compare.inc', 'locale');
// At least the core project should be in the database, so we build the
// data if none are found.
......
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