Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -5,6 +5,8 @@
|
|||
* Installation functions for Content Translation module.
|
||||
*/
|
||||
|
||||
use \Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
|
@ -12,20 +14,19 @@ function content_translation_install() {
|
|||
// Assign a fairly low weight to ensure our implementation of
|
||||
// hook_module_implements_alter() is run among the last ones.
|
||||
module_set_weight('content_translation', 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_enable().
|
||||
*/
|
||||
function content_translation_enable() {
|
||||
// Translation works when at least two languages are added.
|
||||
if (count(\Drupal::languageManager()->getLanguages()) < 2) {
|
||||
$t_args = array(':language_url' => \Drupal::url('entity.configurable_language.collection'));
|
||||
$message = t('Be sure to <a href=":language_url">add at least two languages</a> to translate content.', $t_args);
|
||||
$t_args = [
|
||||
':language_url' => Url::fromRoute('entity.configurable_language.collection')->toString()
|
||||
];
|
||||
$message = t('This site has only a single language enabled. <a href=":language_url">Add at least one more language</a> in order to translate content.', $t_args);
|
||||
drupal_set_message($message, 'warning');
|
||||
}
|
||||
// Point the user to the content translation settings.
|
||||
$t_args = array(':settings_url' => \Drupal::url('language.content_settings_page'));
|
||||
$t_args = [
|
||||
':settings_url' => Url::fromRoute('language.content_settings_page')->toString()
|
||||
];
|
||||
$message = t('<a href=":settings_url">Enable translation</a> for <em>content types</em>, <em>taxonomy vocabularies</em>, <em>accounts</em>, or any other element you wish to translate.', $t_args);
|
||||
drupal_set_message($message, 'warning');
|
||||
}
|
||||
|
|
Reference in a new issue