Skip to content
Snippets Groups Projects
Commit 5b399aec authored by catch's avatar catch
Browse files

Issue #2228799 by pmagunia, mohit_aghera, rpayanm, lalitware, AkashKumar07,...

Issue #2228799 by pmagunia, mohit_aghera, rpayanm, lalitware, AkashKumar07, quietone, bnjmnm: Change page title "Content language" when Content Translation module is enabled
parent ff619a06
No related branches found
No related tags found
25 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4289Issue #1344552 by marcingy, Niklas Fiekas, Ravi.J, aleevas, Eduardo Morales...,!4114Issue #2707291: Disable body-level scrolling when a dialog is open as a modal,!4100Issue #3249600: Add support for PHP 8.1 Enums as allowed values for list_* data types,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1484Exposed filters get values from URL when Ajax is on,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!925Issue #2339235: Remove taxonomy hard dependency on node module,!877Issue #2708101: Default value for link text is not saved,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!844Resolve #3036010 "Updaters",!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -81,7 +81,7 @@ language.negotiation_browser_delete:
language.content_settings_page:
path: '/admin/config/regional/content-language'
defaults:
_title: 'Content language'
_title_callback: '\Drupal\language\Form\ContentLanguageSettingsForm::getTitle'
_form: '\Drupal\language\Form\ContentLanguageSettingsForm'
requirements:
_permission: 'administer languages'
......@@ -5,6 +5,7 @@
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\language\Entity\ContentLanguageSettings;
......@@ -38,6 +39,13 @@ class ContentLanguageSettingsForm extends FormBase {
*/
protected $multipleCapable = TRUE;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs an \Drupal\views\Plugin\views\argument_validator\Entity object.
*
......@@ -45,10 +53,13 @@ class ContentLanguageSettingsForm extends FormBase {
* The entity type manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, ModuleHandlerInterface $module_handler) {
$this->entityTypeManager = $entity_type_manager;
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->moduleHandler = $module_handler;
}
/**
......@@ -57,10 +68,26 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity_type.manager'),
$container->get('entity_type.bundle.info')
$container->get('entity_type.bundle.info'),
$container->get('module_handler')
);
}
/**
* The _title_callback for the language.content_settings_page route.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* The page title.
*/
public function getTitle(): string {
if ($this->moduleHandler->moduleExists('content_translation')) {
return $this->t('Content language and translation');
}
else {
return $this->t('Content language');
}
}
/**
* {@inheritdoc}
*/
......
......@@ -91,4 +91,18 @@ public function testLanguageStringSelector() {
$this->assertSame($name_translation, $option->getText());
}
/**
* Tests that correct title is displayed for content translation page.
*/
public function testContentTranslationPageTitle() {
$this->drupalGet('admin/config/regional/content-language');
$this->assertSession()->pageTextContains('Content language and translation');
$this->assertSession()->pageTextNotMatches('#Content language$#');
\Drupal::service('module_installer')->uninstall(['content_translation']);
$this->drupalGet('admin/config/regional/content-language');
$this->assertSession()->pageTextContains('Content language');
$this->assertSession()->pageTextNotContains('Content language and translation');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment