本文整理汇总了PHP中Drupal\Core\Language\LanguageManagerInterface::updateLockedLanguageWeights方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManagerInterface::updateLockedLanguageWeights方法的具体用法?PHP LanguageManagerInterface::updateLockedLanguageWeights怎么用?PHP LanguageManagerInterface::updateLockedLanguageWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Language\LanguageManagerInterface
的用法示例。
在下文中一共展示了LanguageManagerInterface::updateLockedLanguageWeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
parent::submitForm($form, $form_state);
// Save the default language if changed.
$new_id = $form_state->getValue('site_default_language');
if ($new_id != $this->languageManager->getDefaultLanguage()->getId()) {
$this->configFactory->getEditable('system.site')->set('default_langcode', $new_id)->save();
$this->languageManager->reset();
}
if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) {
$this->languageManager->updateLockedLanguageWeights();
}
drupal_set_message(t('Configuration saved.'));
// Force the redirection to the page with the language we have just
// selected as default.
$form_state->setRedirectUrl($this->entities[$new_id]->urlInfo('collection', array('language' => $this->entities[$new_id])));
}