class LingotekNotificationController in Lingotek Translation 8.2
Same name and namespace in other branches
- 8 src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 4.0.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.0.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.1.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.2.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.3.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.4.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.5.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.6.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.7.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
- 3.8.x src/Controller/LingotekNotificationController.php \Drupal\lingotek\Controller\LingotekNotificationController
Returns responses for lingotek module setup routes.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase implements ContainerInjectionInterface uses LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\lingotek\Controller\LingotekControllerBase uses LingotekSetupTrait
- class \Drupal\lingotek\Controller\LingotekNotificationController
- class \Drupal\lingotek\Controller\LingotekControllerBase uses LingotekSetupTrait
Expanded class hierarchy of LingotekNotificationController
File
- src/
Controller/ LingotekNotificationController.php, line 29
Namespace
Drupal\lingotek\ControllerView source
class LingotekNotificationController extends LingotekControllerBase {
/**
* The Lingotek configuration service.
*
* @var \Drupal\lingotek\LingotekConfigurationServiceInterface
*/
protected $lingotekConfiguration;
/**
* The Lingotek content translation service.
*
* @var \Drupal\lingotek\LingotekContentTranslationServiceInterface
*/
protected $lingotekContentTranslation;
/**
* The Lingotek configuration translation service.
*
* @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface
*/
protected $lingotekConfigTranslation;
/**
* Constructs a LingotekControllerBase object.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The Request instance.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\lingotek\LingotekInterface $lingotek
* The lingotek service.
* @param \Drupal\lingotek\LanguageLocaleMapperInterface $language_locale_mapper
* The language-locale mapper.
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder
* The form builder.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
* @param \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_configuration
* The Lingotek configuration service.
* @param \Drupal\lingotek\LingotekContentTranslationServiceInterface $content_translation_service
* The Lingotek content translation service.
* @param \Drupal\lingotek\LingotekConfigTranslationServiceInterface $config_translation_service
* The Lingotek config translation service.
*/
public function __construct(Request $request, ConfigFactoryInterface $config_factory, LingotekInterface $lingotek, LanguageLocaleMapperInterface $language_locale_mapper, FormBuilderInterface $form_builder, LoggerInterface $logger, LingotekConfigurationServiceInterface $lingotek_configuration, LingotekContentTranslationServiceInterface $content_translation_service, LingotekConfigTranslationServiceInterface $config_translation_service) {
parent::__construct($request, $config_factory, $lingotek, $language_locale_mapper, $form_builder, $logger);
$this->lingotekConfiguration = $lingotek_configuration;
$this->lingotekContentTranslation = $content_translation_service;
$this->lingotekConfigTranslation = $config_translation_service;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('request_stack')
->getCurrentRequest(), $container
->get('config.factory'), $container
->get('lingotek'), $container
->get('lingotek.language_locale_mapper'), $container
->get('form_builder'), $container
->get('logger.channel.lingotek'), $container
->get('lingotek.configuration'), $container
->get('lingotek.content_translation'), $container
->get('lingotek.config_translation'));
}
public function endpoint(Request $request) {
$translation_service = $this->lingotekContentTranslation;
$request_method = $request
->getMethod();
$http_status_code = Response::HTTP_ACCEPTED;
$type = $request->query
->get('type');
$result = [];
$messages = [];
$security_token = $request->query
->get('security_token');
if ($security_token == 1) {
$http_status_code = Response::HTTP_ACCEPTED;
}
switch ($type) {
// all translations for all documents have been completed for the project
case 'project':
// ex. ?project_id=103956f4-17cf-4d79-9d15-5f7b7a88dee2&progress=100&type=project
break;
case 'document':
break;
case 'document_archived':
$entity = $this
->getEntity($request->query
->get('document_id'));
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
// We need to unset the document id first, so there's no cancelling
// call to the TMS.
$translation_service
->setDocumentId($entity, NULL);
$translation_service
->deleteMetadata($entity);
$http_status_code = Response::HTTP_OK;
$messages[] = new FormattableMarkup('Document @label was archived in Lingotek.', [
'@label' => $entity
->label(),
]);
}
break;
case 'document_cancelled':
$documentId = $request->query
->get('document_id');
$entity = $this
->getEntity($documentId);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
$this->lingotekConfiguration
->setConfigEntityProfile($entity, NULL);
}
elseif ($entity instanceof ContentEntityInterface) {
$this->lingotekConfiguration
->setProfile($entity, NULL);
}
$http_status_code = Response::HTTP_OK;
$translation_service
->setDocumentId($entity, NULL);
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_CANCELLED);
$translation_service
->setTargetStatuses($entity, Lingotek::STATUS_CANCELLED);
$this->logger
->log(LogLevel::DEBUG, 'Document @label cancelled in TMS.', [
'@label' => $entity
->label(),
]);
$messages[] = new FormattableMarkup('Document @label cancelled in TMS.', [
'@label' => $entity
->label(),
]);
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
break;
// a document has uploaded and imported successfully for document_id
case 'document_uploaded':
$entity = $this
->getEntity($request->query
->get('document_id'));
/** @var \Drupal\lingotek\Entity\LingotekProfile $profile */
$profile = $this
->getProfile($entity);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$http_status_code = Response::HTTP_OK;
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_CURRENT);
$languages = [];
$target_languages = $this
->languageManager()
->getLanguages();
$target_languages = array_filter($target_languages, function (LanguageInterface $language) {
$configLanguage = ConfigurableLanguage::load($language
->getId());
return $this->lingotekConfiguration
->isLanguageEnabled($configLanguage);
});
foreach ($target_languages as $target_language) {
if ($profile
->hasAutomaticRequestForTarget($target_language
->getId())) {
$target_locale = $this->languageLocaleMapper
->getLocaleForLangcode($target_language
->getId());
if ($translation_service
->addTarget($entity, $target_locale)) {
$languages[] = $target_language
->getId();
}
}
}
$result['request_translations'] = $languages;
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
break;
case 'document_updated':
$entity = $this
->getEntity($request->query
->get('document_id'));
/** @var \Drupal\lingotek\Entity\LingotekProfile $profile */
$profile = $this
->getProfile($entity);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$http_status_code = Response::HTTP_OK;
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_CURRENT);
$languages = [];
$target_languages = $this
->languageManager()
->getLanguages();
$target_languages = array_filter($target_languages, function (LanguageInterface $language) {
$configLanguage = ConfigurableLanguage::load($language
->getId());
return $this->lingotekConfiguration
->isLanguageEnabled($configLanguage);
});
foreach ($target_languages as $target_language) {
if ($profile
->hasAutomaticRequestForTarget($target_language
->getId())) {
$target_locale = $this->languageLocaleMapper
->getLocaleForLangcode($target_language
->getId());
if ($translation_service
->addTarget($entity, $target_locale)) {
$languages[] = $target_language
->getId();
}
}
}
$result['request_translations'] = $languages;
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
break;
case 'import_failure':
$prevDocumentId = $request->query
->get('prev_document_id');
$documentId = $request->query
->get('document_id');
$entity = $this
->getEntity($documentId);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$http_status_code = Response::HTTP_OK;
// We update the document id to the previous one no matter what. If it
// was a new document, we want to set the document id to NULL anyway.
$translation_service
->setDocumentId($entity, $prevDocumentId);
$translation_service
->setSourceStatus($entity, Lingotek::STATUS_ERROR);
$this->logger
->log(LogLevel::DEBUG, 'Document import for entity @label failed. Reverting @documentId to previous id @prevDocumentId', [
'@label' => $entity
->label(),
'@documentId' => $documentId,
'@prevDocumentId' => $prevDocumentId ?: '(NULL)',
]);
$messages[] = new FormattableMarkup('Document import for entity @label failed. Reverting @documentId to previous id @prevDocumentId', [
'@label' => $entity
->label(),
'@documentId' => $documentId,
'@prevDocumentId' => $prevDocumentId ?: '(NULL)',
]);
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
break;
case 'target_cancelled':
$documentId = $request->query
->get('document_id');
$locale = $request->query
->get('locale');
$entity = $this
->getEntity($documentId);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$http_status_code = Response::HTTP_OK;
$langcode = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale)
->id();
$translation_service
->setTargetStatus($entity, $langcode, Lingotek::STATUS_CANCELLED);
$this->logger
->log(LogLevel::DEBUG, 'Document @label target @locale cancelled in TMS.', [
'@label' => $entity
->label(),
'@locale' => $locale,
]);
$messages[] = new FormattableMarkup('Document @label target @locale cancelled in TMS.', [
'@label' => $entity
->label(),
'@locale' => $locale,
]);
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
break;
case 'target_deleted':
/**
* array(
* 'community_id' => 'my_community_id',
* 'complete' => 'true',
* 'deleted_at' => '1536115104487',
* 'deleted_by_user_id' => 'user_hash',
* 'deleted_by_user_login' => 'user@example.com',
* 'deleted_by_user_name' => 'Name Surname',
* 'doc_cts' => '1536115021300',
* 'doc_domain_type' => 'http://example.com',
* 'doc_region' => '',
* 'doc_status' => 'COMPLETE',
* 'documentId' => 'document_tms_id',
* 'document_id' => 'document_id',
* 'locale' => 'ca_ES',
* 'locale_code' => 'ca-ES',
* 'original_project_id' => '0',
* 'progress' => '100',
* 'projectId' => 'project_tms_id',
* 'project_id' => 'project_id_hash',
* 'status' => 'COMPLETE',
* 'targetId' => 'target_tms_id',
* 'target_id' => 'target_hash',
* 'type' => 'target_deleted',
* )
*/
$entity = $this
->getEntity($request->query
->get('document_id'));
if ($entity !== NULL) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$locale = $request->query
->get('locale');
$langcode = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale)
->id();
$user_login = $request->query
->get('deleted_by_user_login');
$translation_service
->setTargetStatus($entity, $langcode, Lingotek::STATUS_UNTRACKED);
$this->logger
->log(LogLevel::DEBUG, 'Target @locale for entity @label deleted by @user_login', [
'@locale' => $locale,
'@user_login' => $user_login,
'@label' => $entity
->label(),
]);
$http_status_code = Response::HTTP_OK;
$messages[] = new FormattableMarkup('Target @locale for entity @label deleted by @user_login', [
'@locale' => $locale,
'@user_login' => $user_login,
'@label' => $entity
->label(),
]);
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$document_id = $request->query
->get('document_id');
$user_login = $request->query
->get('deleted_by_user_login');
$locale = $request->query
->get('locale');
$this->logger
->log(LogLevel::WARNING, 'Target @locale for document @document_id deleted by @user_login in the TMS, but document not found on the system.', [
'@locale' => $locale,
'@user_login' => $user_login,
'@document_id' => $document_id,
]);
}
break;
case 'document_deleted':
/**
* array(
* 'community_id' => 'my_community_id',
* 'complete' => 'true',
* 'deleted_at' => '1536171165274',
* 'deleted_by_user_id' => 'user_hash',
* 'deleted_by_user_login' => 'user@example.com',
* 'deleted_by_user_name' => 'Name Surname',
* 'documentId' => 'document_tms_id',
* 'document_id' => 'document_id',
* 'original_project_id' => '0',
* 'progress' => '100',
* 'projectId' => 'project_tms_id',
* 'project_id' => 'project_id_hash',
* 'type' => 'document_deleted',
* )
*/
$entity = $this
->getEntity($request->query
->get('document_id'));
if ($entity !== NULL) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$user_login = $request->query
->get('deleted_by_user_login');
$translation_service
->deleteMetadata($entity);
$this->logger
->log(LogLevel::DEBUG, 'Document for entity @label deleted by @user_login in the TMS.', [
'@user_login' => $user_login,
'@label' => $entity
->label(),
]);
$http_status_code = Response::HTTP_OK;
$messages[] = new FormattableMarkup('Document for entity @label deleted by @user_login in the TMS.', [
'@user_login' => $user_login,
'@label' => $entity
->label(),
]);
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$document_id = $request->query
->get('document_id');
$user_login = $request->query
->get('deleted_by_user_login');
$this->logger
->log(LogLevel::WARNING, 'Document @document_id deleted by @user_login in the TMS, but not found on the system.', [
'@user_login' => $user_login,
'@document_id' => $document_id,
]);
}
break;
case 'phase':
// translation (i.e., chinese) has been completed for a document
case 'target':
// TO-DO: download target for locale_code and document_id (also, progress and complete params can be used as needed)
// ex. ?project_id=103956f4-17cf-4d79-9d15-5f7b7a88dee2&locale_code=de-DE&document_id=bbf48a7b-b201-47a0-bc0e-0446f9e33a2f&complete=true&locale=de_DE&progress=100&type=target
$document_id = $request->query
->get('document_id');
$locale = $request->query
->get('locale');
$langcode = $this->languageLocaleMapper
->getConfigurableLanguageForLocale($locale)
->id();
$lock = \Drupal::lock();
$lock_name = __FUNCTION__ . ':' . $document_id;
do {
if ($lock
->lockMayBeAvailable($lock_name)) {
if ($held = $lock
->acquire($lock_name)) {
break;
}
}
$lock
->wait($lock_name, rand(1, 3));
} while (TRUE);
try {
$entity = $this
->getEntity($document_id);
/** @var \Drupal\lingotek\Entity\LingotekProfile $profile */
$profile = $this
->getProfile($entity);
if ($entity) {
if ($entity instanceof ConfigEntityInterface) {
$translation_service = $this->lingotekConfigTranslation;
}
$allowInterimDownloads = $this->lingotekConfiguration
->getPreference('enable_download_interim');
$progressCompleted = $request->query
->get('progress') == '100';
if ($progressCompleted) {
$translation_service
->setTargetStatus($entity, $langcode, Lingotek::STATUS_READY);
}
if ($profile
->hasAutomaticDownloadForTarget($langcode) && $profile
->hasAutomaticDownloadWorker() && ($progressCompleted || $allowInterimDownloads)) {
$queue = \Drupal::queue('lingotek_downloader_queue_worker');
$item = [
'entity_type_id' => $entity
->getEntityTypeId(),
'entity_id' => $entity
->id(),
'locale' => $locale,
'document_id' => $document_id,
];
$result['download_queued'] = $queue
->createItem($item);
}
elseif ($profile
->hasAutomaticDownloadForTarget($langcode) && !$profile
->hasAutomaticDownloadWorker() && ($progressCompleted || $allowInterimDownloads)) {
$result['download'] = $translation_service
->downloadDocument($entity, $locale);
}
else {
$result['download'] = FALSE;
}
if (isset($result['download']) && $result['download']) {
$messages[] = "Document downloaded.";
$http_status_code = Response::HTTP_OK;
}
elseif (isset($result['download_queued']) && $result['download_queued']) {
$messages[] = new FormattableMarkup('Download for target @locale in document @document has been queued.', [
'@locale' => $locale,
'@document' => $document_id,
]);
$result['download_queued'] = TRUE;
$http_status_code = Response::HTTP_OK;
}
elseif (!$allowInterimDownloads && !$progressCompleted) {
$messages[] = new FormattableMarkup('Interim downloads are disabled, so no download for target @locale happened in document @document.', [
'@locale' => $locale,
'@document' => $document_id,
]);
$http_status_code = Response::HTTP_OK;
}
else {
$messages[] = new FormattableMarkup('No download for target @locale happened in document @document.', [
'@locale' => $locale,
'@document' => $document_id,
]);
if (!$profile
->hasAutomaticDownloadForTarget($langcode)) {
$http_status_code = Response::HTTP_OK;
}
else {
$http_status_code = Response::HTTP_SERVICE_UNAVAILABLE;
}
}
}
else {
$http_status_code = Response::HTTP_NO_CONTENT;
$messages[] = "Document not found.";
}
} catch (\Exception $exception) {
$http_status_code = Response::HTTP_SERVICE_UNAVAILABLE;
$messages[] = new FormattableMarkup('Download of target @locale for document @document failed', [
'@locale' => $locale,
'@document' => $document_id,
]);
} finally {
$lock
->release($lock_name);
}
break;
// ignore
default:
$this->logger
->log(LogLevel::WARNING, 'Unmanaged notification callback from the TMS. Arguments were: @arguments.', [
'@arguments' => var_export($request->query
->all(), TRUE),
]);
$http_status_code = Response::HTTP_ACCEPTED;
$response = new HtmlResponse('It works, but nothing to look here.', $http_status_code);
$response
->setMaxAge(0)
->setSharedMaxAge(0)
->getCacheableMetadata()
->addCacheContexts([
'url.query_args',
]);
return $response;
break;
}
$response = [
'service' => 'notify',
'method' => $request_method,
'params' => $request->query
->all(),
'result' => $result,
'messages' => $messages,
];
$response = CacheableJsonResponse::create($response, $http_status_code)
->setMaxAge(0)
->setSharedMaxAge(0);
$response
->getCacheableMetadata()
->addCacheContexts([
'url.query_args',
]);
return $response;
}
protected function getProfile($entity) {
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $configuration_service */
$configuration_service = \Drupal::service('lingotek.configuration');
$profile = NULL;
if ($entity instanceof ContentEntityInterface) {
$profile = $configuration_service
->getEntityProfile($entity, FALSE);
}
elseif ($entity instanceof ConfigEntityInterface) {
$profile = $configuration_service
->getConfigEntityProfile($entity, FALSE);
}
return $profile;
}
protected function getEntity($document_id) {
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.content_translation');
$entity = $translation_service
->loadByDocumentId($document_id);
if ($entity === NULL) {
/** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $translation_service */
$translation_service = \Drupal::service('lingotek.config_translation');
$entity = $translation_service
->loadByDocumentId($document_id);
}
return $entity;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ControllerBase:: |
protected | property | The current user service. | 1 |
ControllerBase:: |
protected | property | The entity form builder. | |
ControllerBase:: |
protected | property | The entity manager. | |
ControllerBase:: |
protected | property | The entity type manager. | |
ControllerBase:: |
protected | property | The key-value storage. | 1 |
ControllerBase:: |
protected | property | The language manager. | 1 |
ControllerBase:: |
protected | property | The module handler. | 2 |
ControllerBase:: |
protected | property | The state service. | |
ControllerBase:: |
protected | function | Returns the requested cache bin. | |
ControllerBase:: |
protected | function | Retrieves a configuration object. | |
ControllerBase:: |
private | function | Returns the service container. | |
ControllerBase:: |
protected | function | Returns the current user. | 1 |
ControllerBase:: |
protected | function | Retrieves the entity form builder. | |
ControllerBase:: |
protected | function | Retrieves the entity manager service. | |
ControllerBase:: |
protected | function | Retrieves the entity type manager. | |
ControllerBase:: |
protected | function | Returns the form builder service. | 2 |
ControllerBase:: |
protected | function | Returns a key/value storage collection. | 1 |
ControllerBase:: |
protected | function | Returns the language manager service. | 1 |
ControllerBase:: |
protected | function | Returns the module handler. | 2 |
ControllerBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
ControllerBase:: |
protected | function | Returns the state storage service. | |
LingotekControllerBase:: |
protected | property |
The config factory. Overrides ControllerBase:: |
|
LingotekControllerBase:: |
protected | property |
The form builder. Overrides ControllerBase:: |
|
LingotekControllerBase:: |
protected | property | The language-locale mapper. | |
LingotekControllerBase:: |
protected | property | A logger instance. | |
LingotekControllerBase:: |
protected | property | A Symfony request instance | |
LingotekControllerBase:: |
public | function | Checks if site is connected to Lingotek. | |
LingotekControllerBase:: |
protected | function | Return a Lingotek form (convenience function) | |
LingotekNotificationController:: |
protected | property | The Lingotek configuration translation service. | |
LingotekNotificationController:: |
protected | property | The Lingotek configuration service. | |
LingotekNotificationController:: |
protected | property | The Lingotek content translation service. | |
LingotekNotificationController:: |
public static | function |
Instantiates a new instance of this class. Overrides LingotekControllerBase:: |
|
LingotekNotificationController:: |
public | function | ||
LingotekNotificationController:: |
protected | function | ||
LingotekNotificationController:: |
protected | function | ||
LingotekNotificationController:: |
public | function |
Constructs a LingotekControllerBase object. Overrides LingotekControllerBase:: |
|
LingotekSetupTrait:: |
protected | property | A lingotek connector object | |
LingotekSetupTrait:: |
protected | function | Verify the Lingotek Translation module has been properly initialized. | |
LingotekSetupTrait:: |
public | function | Checks if Lingotek module is completely set up. | |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |