class ScheduledTransitionAddForm in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/Form/Entity/ScheduledTransitionAddForm.php \Drupal\scheduled_transitions\Form\Entity\ScheduledTransitionAddForm
Scheduled transitions add form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\scheduled_transitions\Form\Entity\ScheduledTransitionAddForm
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of ScheduledTransitionAddForm
1 file declares its use of ScheduledTransitionAddForm
File
- src/
Form/ Entity/ ScheduledTransitionAddForm.php, line 31
Namespace
Drupal\scheduled_transitions\Form\EntityView source
class ScheduledTransitionAddForm extends ContentEntityForm {
/**
* Constant indicating the form key representing: latest revision.
*
* @internal will be made protected when PHP version is raised.
*/
const LATEST_REVISION = 'latest_revision';
/**
* Various date related functionality.
*
* @var \Drupal\Core\Datetime\DateFormatterInterface
*/
protected $dateFormatter;
/**
* General service for moderation-related questions about Entity API.
*
* @var \Drupal\content_moderation\ModerationInformationInterface
*/
protected $moderationInformation;
/**
* Validates whether a certain state transition is allowed.
*
* @var \Drupal\content_moderation\StateTransitionValidationInterface
*/
protected $stateTransitionValidation;
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a new ScheduledTransitionAddForm.
*
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
* The entity repository service.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle service.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter
* Various date related functionality.
* @param \Drupal\content_moderation\ModerationInformationInterface $moderationInformation
* General service for moderation-related questions about Entity API.
* @param \Drupal\content_moderation\StateTransitionValidationInterface $stateTransitionValidation
* Validates whether a certain state transition is allowed.
* @param \Drupal\Core\Language\LanguageManagerInterface $languageManager
* The language manager.
*/
public function __construct(EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, DateFormatterInterface $dateFormatter, ModerationInformationInterface $moderationInformation, StateTransitionValidationInterface $stateTransitionValidation, LanguageManagerInterface $languageManager) {
parent::__construct($entity_repository, $entity_type_bundle_info, $time);
$this->dateFormatter = $dateFormatter;
$this->moderationInformation = $moderationInformation;
$this->stateTransitionValidation = $stateTransitionValidation;
$this->languageManager = $languageManager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity.repository'), $container
->get('entity_type.bundle.info'), $container
->get('datetime.time'), $container
->get('date.formatter'), $container
->get('content_moderation.moderation_information'), $container
->get('content_moderation.state_transition_validation'), $container
->get('language_manager'));
}
/**
* {@inheritdoc}
*/
public function getBaseFormId() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) : array {
$account = $this
->currentUser();
$form['scheduled_transitions']['#theme'] = 'scheduled_transitions_form_add';
$entity = $this
->getEntity();
$header = [];
$header['revision_id'] = $this
->t('Revision');
$header['state'] = $this
->t('State');
if ($entity instanceof RevisionLogInterface) {
$header['revision_time'] = $this
->t('Saved on');
$header['revision_author'] = $this
->t('Saved by');
$header['revision_log'] = $this
->t('Log');
}
$newMetaWrapperId = 'new-meta-wrapper';
$input = $form_state
->getUserInput();
$revisionOptions = $this
->getRevisionOptions($entity);
// Use the selected option (if form is being rebuilt from AJAX), otherwise
// select latest revision if it exists.
$revision = $input['revision'] ?? (isset($revisionOptions[static::LATEST_REVISION]) ? static::LATEST_REVISION : NULL);
$form['scheduled_transitions']['revision'] = [
'#type' => 'tableselect',
'#header' => $header,
'#caption' => $this
->t('Select which revision you wish to move to a new state.'),
'#options' => $revisionOptions,
'#multiple' => FALSE,
'#footer' => [
[
[
'colspan' => count($header) + 1,
'data' => [
'#plain_text' => $this
->t('Revisions are ordered from newest to oldest.'),
],
],
],
],
'#process' => [
[
Tableselect::class,
'processTableselect',
],
'::revisionProcess',
],
'#new_meta_wrapper_id' => $newMetaWrapperId,
'#default_value' => $revision,
];
$form['scheduled_transitions']['new_meta'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'container-inline',
],
],
'#prefix' => '<div id="' . $newMetaWrapperId . '">',
'#suffix' => '</div>',
];
$workflow = $this->moderationInformation
->getWorkflowForEntity($entity);
$workflowPlugin = $workflow
->getTypePlugin();
// Populate options with nothing.
if (is_numeric($revision) && $revision > 0) {
$entityStorage = $this->entityTypeManager
->getStorage($entity
->getEntityTypeId());
$entityRevision = $entityStorage
->loadRevision($revision);
$toTransitions = $this->stateTransitionValidation
->getValidTransitions($entityRevision, $this
->currentUser());
}
elseif (is_string($revision)) {
// Show all transitions as we cannot be sure what will be available.
// Cannot use getValidTransitions since it is only valid for the current
// state of the entity passed to it:
$toTransitions = array_filter($workflowPlugin
->getTransitions(), function (Transition $transition) use ($workflow, $account) {
return $account
->hasPermission('use ' . $workflow
->id() . ' transition ' . $transition
->id());
});
}
if (isset($toTransitions)) {
$transitionOptions = [];
foreach ($toTransitions as $toTransition) {
$transitionOptions[$toTransition
->id()] = $toTransition
->label();
}
$form['scheduled_transitions']['new_meta']['transition_help']['#markup'] = $this
->t('<strong>Execute transition</strong>');
$form['scheduled_transitions']['new_meta']['transition'] = [
'#type' => 'select',
'#options' => $transitionOptions,
'#empty_option' => $this
->t('- Select -'),
'#required' => TRUE,
];
$form['scheduled_transitions']['new_meta']['on_help']['#markup'] = $this
->t('<strong>on date</strong>');
$form['scheduled_transitions']['new_meta']['on'] = [
'#type' => 'datetime',
'#default_value' => new \DateTime(),
'#required' => TRUE,
];
}
else {
$form['scheduled_transitions']['new_meta']['transition_help']['#markup'] = $this
->t('Select a revision above');
}
$form['scheduled_transitions']['to_options'] = [
'#type' => 'container',
];
if (isset($toTransitions) && count($toTransitions) > 0) {
// Its too difficult to have a checkbox with default TRUE with conditional
// existence, as AJAX reloads, will sometimes show the checkbox as
// unchecked. See https://www.drupal.org/project/drupal/issues/1100170.
// Instead show this checkbox depending on value of other fields. The
// checkbox will always be present therefore preserving its state.
$conditions = [];
foreach ($toTransitions as $transition) {
if ($transition
->to()
->isDefaultRevisionState()) {
$conditions[] = [
':input[name="transition"]' => [
'value' => $transition
->id(),
],
];
}
}
$form['scheduled_transitions']['to_options']['recreate_non_default_head'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Recreate pending revision'),
'#description' => $this
->t('Before creating this revision, check if there is any pending work. If so then recreate it. Regardless of choice, revisions are safely retained in history, and can be reverted manually.'),
'#default_value' => TRUE,
'#states' => [
'visible' => $conditions,
],
];
}
return $form;
}
/**
* Add AJAX functionality to revision radios.
*
* @param array $element
* The element.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* Form state.
* @param array $complete_form
* Complete form.
*
* @return array
* The modified element.
*/
public function revisionProcess(array &$element, FormStateInterface $form_state, array &$complete_form) : array {
// Add AJAX to tableselect.
$newMetaWrapperId = $element['#new_meta_wrapper_id'];
foreach (Element::children($element) as $key) {
$element[$key]['#ajax'] = [
'event' => 'change',
'callback' => '::ajaxCallbackNewMeta',
'wrapper' => $newMetaWrapperId,
'progress' => [
'type' => 'fullscreen',
],
'effect' => 'fade',
];
}
return $element;
}
/**
* Ajax handler for new meta container.
*/
public function ajaxCallbackNewMeta($form, FormStateInterface $form_state) : array {
return $form['scheduled_transitions']['new_meta'];
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) : void {
if (empty($form_state
->getValue('revision'))) {
$form_state
->setError($form['scheduled_transitions']['revision'], $this
->t('Revision must be selected.'));
}
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) : void {
$entity = $this
->getEntity();
$options = [];
if ($form_state
->getValue('recreate_non_default_head')) {
$options[ScheduledTransition::OPTION_RECREATE_NON_DEFAULT_HEAD] = TRUE;
}
$revisionOption = $form_state
->getValue('revision');
$entityRevisionId = 0;
if ($revisionOption === static::LATEST_REVISION) {
$options[ScheduledTransition::OPTION_LATEST_REVISION] = TRUE;
}
else {
$entityRevisionId = $revisionOption;
}
$workflow = $this->moderationInformation
->getWorkflowForEntity($entity);
$transition = $form_state
->getValue([
'transition',
]);
$workflowPlugin = $workflow
->getTypePlugin();
$newState = $workflowPlugin
->getTransition($transition)
->to()
->id();
/** @var \Drupal\Core\Datetime\DrupalDateTime $onDate */
$onDate = $form_state
->getValue([
'on',
]);
$scheduledTransitionStorage = $this->entityTypeManager
->getStorage('scheduled_transition');
/** @var \Drupal\scheduled_transitions\Entity\ScheduledTransitionInterface $scheduledTransition */
$scheduledTransition = $scheduledTransitionStorage
->create([
'entity' => [
$entity,
],
'entity_revision_id' => $entityRevisionId,
'entity_revision_langcode' => $this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId(),
'author' => [
$this
->currentUser()
->id(),
],
'workflow' => $workflow
->id(),
'moderation_state' => $newState,
'transition_on' => $onDate
->getTimestamp(),
'options' => [
$options,
],
]);
$scheduledTransition
->save();
$this
->messenger()
->addMessage($this
->t('Scheduled a transition for @date', [
'@date' => $this->dateFormatter
->format($onDate
->getTimestamp()),
]));
}
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state) : array {
$actions['submit']['#attached']['library'][] = 'core/drupal.dialog.ajax';
$actions['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Schedule transition'),
'#submit' => [
'::submitForm',
],
];
return $actions;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) : void {
// Not saving.
}
/**
* Get revisions for an entity as options for a tableselect.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* Get revisions for this entity.
*
* @return array
* An array of options suitable for a tableselect element.
*/
protected function getRevisionOptions(EntityInterface $entity) : array {
$entityTypeId = $entity
->getEntityTypeId();
$entityDefinition = $this->entityTypeManager
->getDefinition($entityTypeId);
$entityStorage = $this->entityTypeManager
->getStorage($entityTypeId);
$workflow = $this->moderationInformation
->getWorkflowForEntity($entity);
$workflowPlugin = $workflow
->getTypePlugin();
$workflowStates = $workflowPlugin ? $workflowPlugin
->getStates() : [];
/** @var int[] $ids */
$ids = $entityStorage
->getQuery()
->allRevisions()
->condition($entityDefinition
->getKey('id'), $entity
->id())
->condition($entityDefinition
->getKey('langcode'), $this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId())
->sort($entityDefinition
->getKey('revision'), 'DESC')
->execute();
$revisionIds = array_keys($ids);
$entityRevisions = array_map(function (string $revisionId) use ($entityStorage) : EntityInterface {
$revision = $entityStorage
->loadRevision($revisionId);
// When the entity is translatable, load the translation for the current
// language.
if ($revision instanceof TranslatableInterface) {
$revision = $revision
->getTranslation($this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId());
}
return $revision;
}, array_combine($revisionIds, $revisionIds));
// When the entity is translatable, every revision contains a copy for every
// translation. We only want to show the revisions that affected the
// translation for the current language.
$entityRevisions = array_filter($entityRevisions, function (EntityInterface $revision) {
return $revision instanceof TranslatableRevisionableInterface ? $revision
->isRevisionTranslationAffected() : TRUE;
});
$options = array_map(function (EntityInterface $entityRevision) use ($workflowStates) : array {
/** @var \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\RevisionableInterface $entityRevision */
$option = [];
$revisionTArgs = [
'@revision_id' => $entityRevision
->getRevisionId(),
];
// Dont add the arg to toLink in case this particular entity has
// overwritten the default value of the param.
$toLinkArgs = [
$this
->t('#@revision_id', $revisionTArgs),
];
if ($entityRevision
->hasLinkTemplate('revision')) {
$toLinkArgs[] = 'revision';
}
$revisionLink = $entityRevision
->toLink(...$toLinkArgs);
$revisionCell = $revisionLink
->toRenderable();
$revisionCell['#attributes'] = [
'target' => '_blank',
];
$option['revision_id']['data'] = $revisionCell;
$moderationState = $workflowStates[$entityRevision->moderation_state->value] ?? NULL;
$option['state']['data'] = $moderationState ? $moderationState
->label() : $this
->t('- Unknown state -');
if ($entityRevision instanceof RevisionLogInterface) {
$option['revision_time']['data']['#plain_text'] = $this->dateFormatter
->format($entityRevision
->getRevisionCreationTime());
$revisionUser = $entityRevision
->getRevisionUser();
if ($revisionUser) {
$option['revision_author']['data'] = $this->moduleHandler
->moduleExists('user') ? [
'#theme' => 'username',
'#account' => $revisionUser,
] : $revisionUser
->toLink();
}
else {
$option['revision_author']['data'] = $this
->t('- Missing user -');
}
if ($revisionLog = $entityRevision
->getRevisionLogMessage()) {
$option['revision_log']['data'] = [
'#markup' => $revisionLog,
'#allowed_tags' => Xss::getHtmlTagList(),
];
}
else {
$option['revision_log']['data'] = $this
->t('<em>- None -</em>');
}
}
return $option;
}, $entityRevisions);
$options = [
static::LATEST_REVISION => [
'revision_id' => [
'data' => $this
->t('Latest revision'),
],
'state' => [
'data' => $this
->t('Automatically determines the latest revision at time of transition.'),
'colspan' => $entity instanceof RevisionLogInterface ? 4 : 1,
],
],
] + $options;
return $options;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityForm:: |
protected | property |
The entity being used by this form. Overrides EntityForm:: |
9 |
ContentEntityForm:: |
protected | property | The entity repository service. | |
ContentEntityForm:: |
protected | property | The entity type bundle info service. | |
ContentEntityForm:: |
protected | property | The time service. | |
ContentEntityForm:: |
protected | function | Add revision form fields if the entity enabled the UI. | |
ContentEntityForm:: |
public | function |
Builds an updated entity object based upon the submitted form values. Overrides EntityForm:: |
3 |
ContentEntityForm:: |
protected | function |
Copies top-level form values to entity properties Overrides EntityForm:: |
|
ContentEntityForm:: |
protected | function | Flags violations for the current form. | 4 |
ContentEntityForm:: |
protected | function | Returns the bundle entity of the entity, or NULL if there is none. | |
ContentEntityForm:: |
protected | function | Gets the names of all fields edited in the form. | 4 |
ContentEntityForm:: |
public | function |
Gets the form display. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
public | function |
Gets the code identifying the active form language. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function | Should new revisions created on default. | |
ContentEntityForm:: |
protected | function |
Initializes the form state and the entity before the first form build. Overrides EntityForm:: |
1 |
ContentEntityForm:: |
protected | function | Initializes form language code values. | |
ContentEntityForm:: |
public | function |
Checks whether the current form language matches the entity one. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function |
Prepares the entity object before the form is built first. Overrides EntityForm:: |
1 |
ContentEntityForm:: |
public | function |
Sets the form display. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function | Checks whether the revision form fields should be added to the form. | |
ContentEntityForm:: |
public | function | Updates the changed time of the entity. | |
ContentEntityForm:: |
public | function | Updates the form language to reflect any change to the entity language. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
EntityForm:: |
protected | property | The entity type manager. | 3 |
EntityForm:: |
protected | property | The module handler service. | |
EntityForm:: |
protected | property | The name of the current operation. | |
EntityForm:: |
private | property | The entity manager. | |
EntityForm:: |
protected | function | Returns the action form element for the current entity form. | |
EntityForm:: |
public | function | Form element #after_build callback: Updates the entity with submitted data. | |
EntityForm:: |
public | function |
Form constructor. Overrides FormInterface:: |
10 |
EntityForm:: |
public | function |
Gets the form entity. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface:: |
1 |
EntityForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
10 |
EntityForm:: |
public | function |
Gets the operation identifying the form. Overrides EntityFormInterface:: |
|
EntityForm:: |
protected | function | Invokes the specified prepare hook variant. | |
EntityForm:: |
public | function | Process callback: assigns weights and hides extra fields. | |
EntityForm:: |
public | function |
Sets the form entity. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the entity manager for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the entity type manager for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the module handler for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the operation for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function | ||
EntityForm:: |
public | function | ||
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
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. | |
ScheduledTransitionAddForm:: |
protected | property | Various date related functionality. | |
ScheduledTransitionAddForm:: |
protected | property | The language manager. | |
ScheduledTransitionAddForm:: |
protected | property | General service for moderation-related questions about Entity API. | |
ScheduledTransitionAddForm:: |
protected | property | Validates whether a certain state transition is allowed. | |
ScheduledTransitionAddForm:: |
protected | function |
Returns an array of supported actions for the current entity form. Overrides EntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function | Ajax handler for new meta container. | |
ScheduledTransitionAddForm:: |
public static | function |
Instantiates a new instance of this class. Overrides ContentEntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function |
Gets the actual form array to be built. Overrides ContentEntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function |
Returns a string identifying the base form. Overrides EntityForm:: |
|
ScheduledTransitionAddForm:: |
protected | function | Get revisions for an entity as options for a tableselect. | |
ScheduledTransitionAddForm:: |
constant | Constant indicating the form key representing: latest revision. | ||
ScheduledTransitionAddForm:: |
public | function | Add AJAX functionality to revision radios. | |
ScheduledTransitionAddForm:: |
public | function |
Form submission handler for the 'save' action. Overrides EntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function |
This is the default entity object builder function. It is called before any
other submit handler to build the new entity object to be used by the
following submit handlers. At this point of the form workflow the entity is
validated and the form state… Overrides ContentEntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function |
Button-level validation handlers are highly discouraged for entity forms,
as they will prevent entity validation from running. If the entity is going
to be saved during the form submission, this method should be manually
invoked from the button-level… Overrides ContentEntityForm:: |
|
ScheduledTransitionAddForm:: |
public | function |
Constructs a new ScheduledTransitionAddForm. Overrides ContentEntityForm:: |
|
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. |