diff --git a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php index 1bab134..65becdf 100644 --- a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php @@ -9,7 +9,6 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Entity\EntityManager; use Drupal\system\SystemConfigFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -17,7 +16,7 @@ /** * Configure the content language settings for this site. */ -class ContentLanguageSettingsForm extends SystemConfigFormBase implements ControllerInterface { +class ContentLanguageSettingsForm extends SystemConfigFormBase { /** * The entity manager. @@ -60,6 +59,7 @@ public static function create(ContainerInterface $container) { * A list of entity types which are translatable. */ protected function entitySupported() { + $supported = array(); foreach ($this->entityManager->getDefinitions() as $entity_type => $info) { if (!empty($info['translatable'])) { $supported[$entity_type] = $entity_type; @@ -83,12 +83,14 @@ public function buildForm(array $form, array &$form_state) { $labels = array(); $default = array(); + $bundles = entity_get_bundles(); + $language_configuration = array(); foreach ($this->entitySupported() as $entity_type) { $labels[$entity_type] = isset($entity_info[$entity_type]['label']) ? $entity_info[$entity_type]['label'] : $entity_type; $default[$entity_type] = FALSE; // Check whether we have any custom setting. - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { + foreach ($bundles as $bundle => $bundle_info) { $conf = language_get_default_configuration($entity_type, $bundle); if (!empty($conf['language_show']) || $conf['langcode'] != 'site_default') { $default[$entity_type] = $entity_type; @@ -103,7 +105,7 @@ public function buildForm(array $form, array &$form_state) { '#labels' => $labels, '#attached' => array( 'library' => array( - array('language', 'drupal.language.admin') + array('language', 'drupal.language.admin'), ), ), ); @@ -133,7 +135,7 @@ public function buildForm(array $form, array &$form_state) { ), ); - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { + foreach ($bundles as $bundle => $bundle_info) { $form['settings'][$entity_type][$bundle]['settings'] = array( '#type' => 'item', '#label' => $bundle_info['label'], @@ -162,11 +164,10 @@ public function buildForm(array $form, array &$form_state) { * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { - $settings = &$form_state['values']['settings']; - foreach ($settings as $entity_type => $entity_settings) { + $config = $this->configFactory->get('language.settings'); + foreach ($form_state['values']['settings'] as $entity_type => $entity_settings) { foreach ($entity_settings as $bundle => $bundle_settings) { - $this->configFactory->get('language.settings') - ->set(language_get_default_configuration_settings_key($entity_type, $bundle), + $config->set(language_get_default_configuration_settings_key($entity_type, $bundle), array( 'langcode' => $bundle_settings['settings']['language']['langcode'], 'language_show' => $bundle_settings['settings']['langcode']['language_show'], @@ -174,6 +175,7 @@ public function submitForm(array &$form, array &$form_state) { ); } } + $config->save(); parent::submitForm($form, $form_state); } diff --git a/core/modules/locale/lib/Drupal/locale/Controller/LocaleController.php b/core/modules/locale/lib/Drupal/locale/Controller/LocaleController.php index c1aa473..64f70cc 100644 --- a/core/modules/locale/lib/Drupal/locale/Controller/LocaleController.php +++ b/core/modules/locale/lib/Drupal/locale/Controller/LocaleController.php @@ -9,11 +9,13 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\locale\Form\TranslateEditForm; use Drupal\locale\Form\TranslateFilterForm; +use Symfony\Component\HttpFoundation\RedirectResponse; /** * Return response for manual check translations. */ class LocaleController extends ControllerBase { + /** * Checks for translation updates and displays the translations status. * @@ -27,7 +29,7 @@ public function checkTranslation() { // Check translation status of all translatable project in all languages. // First we clear the cached list of projects. Although not strictly - // nescessary, this is helpful in case the project list is out of sync. + // necessary, this is helpful in case the project list is out of sync. locale_translation_flush_projects(); locale_translation_check_projects(); @@ -37,7 +39,8 @@ public function checkTranslation() { return batch_process('admin/reports/translations'); } - return $this->redirect($this->urlGenerator()->generateFromPath('admin/reports/translations', array('absolute' => TRUE))); + // @todo Use $this->redirect() after https://drupal.org/node/1978926. + return new RedirectResponse($this->urlGenerator()->generateFromPath('admin/reports/translations', array('absolute' => TRUE))); } /** @@ -52,4 +55,5 @@ public function translatePage() { 'form' => drupal_get_form(TranslateEditForm::create($this->container)), ); } + } diff --git a/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php index 717f9d2..c33da33 100644 --- a/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php +++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php @@ -79,7 +79,7 @@ public static function create(ContainerInterface $container) { /** * Builds a string search query and returns an array of string objects. * - * @return array $filter_values + * @return \Drupal\locale\TranslationString[] * Array of \Drupal\locale\TranslationString objects. */ protected function translateFilterLoadStrings() { diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 7e2da71..3980802 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -201,7 +201,6 @@ function locale_menu() { $items['admin/config/regional/translate/settings'] = array( 'title' => 'Settings', 'route_name' => 'locale_settings', - 'access arguments' => array('translate interface'), 'weight' => 100, 'type' => MENU_LOCAL_TASK, );