Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
< ? php
/**
* @ file
2013-06-25 19:16:20 +00:00
* Installation functions for Content Translation module .
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
*/
2019-10-03 23:50:26 +00:00
use Drupal\Core\Installer\InstallerKernel ;
2017-08-21 05:01:00 +00:00
use Drupal\Core\Url ;
2016-02-26 11:12:40 +00:00
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
/**
* Implements hook_install () .
*/
2013-06-25 19:16:20 +00:00
function content_translation_install () {
2013-01-07 11:36:47 +00:00
// Assign a fairly low weight to ensure our implementation of
// hook_module_implements_alter() is run among the last ones.
2013-06-25 19:16:20 +00:00
module_set_weight ( 'content_translation' , 10 );
2016-04-12 01:30:08 +00:00
2019-03-07 23:44:31 +00:00
// Skip the guidance messages about enabling translation features if the
// module was installed in the Drupal installation process.
2019-10-03 23:50:26 +00:00
if ( InstallerKernel :: installationAttempted ()) {
2019-03-07 23:44:31 +00:00
return ;
}
2014-05-04 17:19:57 +00:00
// Translation works when at least two languages are added.
2014-03-31 17:29:01 +00:00
if ( count ( \Drupal :: languageManager () -> getLanguages ()) < 2 ) {
2016-04-12 01:30:08 +00:00
$t_args = [
2018-05-11 09:40:33 +00:00
':language_url' => Url :: fromRoute ( 'entity.configurable_language.collection' ) -> toString (),
2016-04-12 01:30:08 +00:00
];
2016-02-11 16:27:57 +00:00
$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 );
2018-05-01 09:15:07 +00:00
\Drupal :: messenger () -> addWarning ( $message );
2013-01-07 11:36:47 +00:00
}
// Point the user to the content translation settings.
2016-04-12 01:30:08 +00:00
$t_args = [
2018-05-11 09:40:33 +00:00
':settings_url' => Url :: fromRoute ( 'language.content_settings_page' ) -> toString (),
2016-04-12 01:30:08 +00:00
];
Issue #2570355 by Sutharsan, stefan.r, kgoel, josephdpurcell, joelpittet, justAChris, dawehner, pfrenssen, pwolanin, David_Rothstein, catch: Replace remaining !placeholder and @placeholder with :placeholder for URLs
2015-09-22 06:16:37 +00:00
$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 );
2018-05-01 09:15:07 +00:00
\Drupal :: messenger () -> addWarning ( $message );
Issue #1188388 by plach, peximo, YesCT | Gábor Hojtsy, fago, webchick, Bojhan, podarok, cosmicdreams, Berdir, aspilicious, bforchhammer, penyaskito: Added Entity translation UI in core.
2012-11-04 02:38:49 +00:00
}
2015-11-12 22:14:00 +00:00
/**
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
* Implements hook_update_last_removed () .
2015-11-12 22:14:00 +00:00
*/
Issue #3087644 by jibran, Berdir, alexpott, longwave, Wim Leers, amateescu, catch, xjm, larowlan, dpi, quietone: Remove Drupal 8 updates up to and including 88**
2020-01-24 23:52:03 +00:00
function content_translation_update_last_removed () {
return 8400 ;
2017-06-29 12:52:17 +00:00
}