class FieldInheritanceForm in Field Inheritance 8
Same name and namespace in other branches
- 2.0.x src/Form/FieldInheritanceForm.php \Drupal\field_inheritance\Form\FieldInheritanceForm
Provides a form for managing field inheritance entities.
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\field_inheritance\Form\FieldInheritanceForm
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of FieldInheritanceForm
File
- src/
Form/ FieldInheritanceForm.php, line 20
Namespace
Drupal\field_inheritance\FormView source
class FieldInheritanceForm extends EntityForm {
/**
* The messenger service.
*
* @var \Drupal\Core\Messenger\Messenger
*/
protected $messenger;
/**
* The entity field manager service.
*
* @var \Drupal\Core\Entity\EntityFieldManager
*/
protected $entityFieldManager;
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
protected $entityTypeManager;
/**
* The entity type bundle info service.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfo
*/
protected $entityTypeBundleInfo;
/**
* The field inheritance plugin manager.
*
* @var \Drupal\field_inheritance\FieldInheritancePluginManager
*/
protected $fieldInheritance;
/**
* Construct an FieldInheritanceForm.
*
* @param \Drupal\Core\Messenger\Messenger $messenger
* The messenger service.
* @param \Drupal\Core\Entity\EntityFieldManager $entity_field_manager
* The entity field manager service.
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
* The entity type manager service.
* @param \Drupal\Core\Entity\EntityTypeBundleInfo $entity_type_bundle_info
* The entity type bundle info service.
* @param \Drupal\field_inheritance\FieldInheritancePluginManager $field_inheritance
* The field inheritance plugin manager.
*/
public function __construct(Messenger $messenger, EntityFieldManager $entity_field_manager, EntityTypeManager $entity_type_manager, EntityTypeBundleInfo $entity_type_bundle_info, FieldInheritancePluginManager $field_inheritance) {
$this->messenger = $messenger;
$this->entityFieldManager = $entity_field_manager;
$this->entityTypeManager = $entity_type_manager;
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->fieldInheritance = $field_inheritance;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('messenger'), $container
->get('entity_field.manager'), $container
->get('entity_type.manager'), $container
->get('entity_type.bundle.info'), $container
->get('plugin.manager.field_inheritance'));
}
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$field_inheritance = $this->entity;
// This form needs AJAX support.
$form['#attached']['library'][] = 'core/jquery.form';
$form['#attached']['library'][] = 'core/drupal.ajax';
$form['#prefix'] = '<div id="field-inheritance-add-form--wrapper">';
$form['#suffix'] = '</div>';
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $field_inheritance
->label(),
'#description' => $this
->t("Label for the Field inheritance."),
'#required' => TRUE,
];
$machine_name_prefix = '';
if ($field_inheritance
->isNew()) {
if (!empty($this->entity->destination_entity_type) && !empty($this->entity->destination_entity_bundle)) {
$machine_name_prefix = $this->entity->destination_entity_type . '_' . $this->entity->destination_entity_bundle . '_';
}
else {
$machine_name_prefix = '[entity-type]_[bundle]_';
}
}
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $field_inheritance
->id(),
'#field_prefix' => $machine_name_prefix,
'#machine_name' => [
'exists' => [
$this,
'exists',
],
],
'#disabled' => !$field_inheritance
->isNew(),
];
$help = [
$this
->t('<b>Inherit</b> - Pull field data directly from the source.'),
$this
->t('<b>Prepend</b> - Place destination data above source data.'),
$this
->t('<b>Append</b> - Place destination data below source data.'),
$this
->t('<b>Fallback</b> - Show destination data, if set, otherwise show source data.'),
];
$form['type'] = [
'#type' => 'select',
'#title' => $this
->t('Inheritance Strategy'),
'#description' => $this
->t('Select the method/strategy used to inherit data.'),
'#options' => [
'inherit' => $this
->t('Inherit'),
'prepend' => $this
->t('Prepend'),
'append' => $this
->t('Append'),
'fallback' => $this
->t('Fallback'),
],
'#required' => TRUE,
'#default_value' => $field_inheritance
->type() ?? 'inherit',
];
$form['information'] = [
'#type' => 'markup',
'#prefix' => '<p>',
'#markup' => implode('</p><p>', $help),
'#suffix' => '</p>',
];
$entity_types = $this->entityTypeManager
->getDefinitions();
$entity_types = array_keys(array_filter($entity_types, function ($type) {
return $type
->entityClassImplements(FieldableEntityInterface::CLASS);
}));
$entity_types = array_combine($entity_types, $entity_types);
$source_entity_bundles = $destination_entity_bundles = [];
$source_entity_fields = $destination_entity_fields = [];
$default_values = [
'' => $this
->t('-- Select --'),
];
$field_values = [];
$form_values = $form_state
->getValues();
if (!$field_inheritance
->isNew()) {
$field_values['source_entity_type'] = $field_inheritance
->sourceEntityType();
$field_values['source_entity_bundle'] = $field_inheritance
->sourceEntityBundle();
$field_values['source_field'] = $field_inheritance
->sourceField();
$field_values['destination_entity_type'] = $field_inheritance
->destinationEntityType();
$field_values['destination_entity_bundle'] = $field_inheritance
->destinationEntityBundle();
}
elseif (!empty($form_values)) {
$field_values['source_entity_type'] = $form_values['source_entity_type'];
$field_values['source_entity_bundle'] = $form_values['source_entity_bundle'];
$field_values['source_field'] = $form_values['source_field'];
$field_values['destination_entity_type'] = $form_values['destination_entity_type'];
$field_values['destination_entity_bundle'] = $form_values['destination_entity_bundle'];
}
if (!empty($field_inheritance
->destinationEntityType()) && empty($form_values)) {
$field_values['destination_entity_type'] = $field_inheritance
->destinationEntityType();
}
if (!empty($field_inheritance
->destinationEntityBundle()) && empty($form_values)) {
$field_values['destination_entity_bundle'] = $field_inheritance
->destinationEntityBundle();
}
if (!empty($form_values['source_field'])) {
$field_values['source_field'] = $form_values['source_field'];
}
if (!empty($field_values['source_entity_type'])) {
$source_entity_bundles = array_keys($this->entityTypeBundleInfo
->getBundleInfo($field_values['source_entity_type']));
$source_entity_bundles = array_combine($source_entity_bundles, $source_entity_bundles);
if (!empty($field_values['source_entity_bundle'])) {
$source_entity_fields = array_keys($this->entityFieldManager
->getFieldDefinitions($field_values['source_entity_type'], $field_values['source_entity_bundle']));
$source_entity_fields = $default_values + array_combine($source_entity_fields, $source_entity_fields);
}
}
if (!empty($field_values['destination_entity_type'])) {
$destination_entity_bundles = array_keys($this->entityTypeBundleInfo
->getBundleInfo($field_values['destination_entity_type']));
$destination_entity_bundles = array_combine($destination_entity_bundles, $destination_entity_bundles);
if (!empty($field_values['destination_entity_bundle'])) {
$destination_entity_fields = array_keys($this->entityFieldManager
->getFieldDefinitions($field_values['destination_entity_type'], $field_values['destination_entity_bundle']));
$destination_entity_fields = $default_values + array_combine($destination_entity_fields, $destination_entity_fields);
// You should never be able to use the inherited field as part of an
// inheritance as that creates an infinite loop.
if (!empty($field_inheritance
->id() && !empty($destination_entity_fields[$field_inheritance
->idWithoutTypeAndBundle()]))) {
unset($destination_entity_fields[$field_inheritance
->idWithoutTypeAndBundle()]);
}
}
}
$form['source'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Source of Data'),
];
$form['source']['source_entity_type'] = [
'#type' => 'select',
'#title' => $this
->t('Source Entity Type'),
'#description' => $this
->t('Select the source entity type from which to inherit data.'),
'#options' => $entity_types,
'#required' => TRUE,
'#default_value' => $field_inheritance
->sourceEntityType(),
'#ajax' => [
'callback' => '::updateFieldOptions',
'wrapper' => 'field-inheritance-add-form--wrapper',
'event' => 'change',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Fetching source options...'),
],
],
];
$form['source']['source_entity_bundle'] = [
'#type' => 'select',
'#title' => $this
->t('Source Entity Bundle'),
'#description' => $this
->t('Select the source entity bundle from which to inherit data.'),
'#options' => $source_entity_bundles,
'#required' => TRUE,
'#default_value' => $field_inheritance
->sourceEntityBundle(),
'#ajax' => [
'callback' => '::updateFieldOptions',
'wrapper' => 'field-inheritance-add-form--wrapper',
'event' => 'change',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Fetching source options...'),
],
],
'#states' => [
'visible' => [
'select[name="source_entity_type"]' => [
'!value' => '',
],
],
],
];
$form['source']['source_field'] = [
'#type' => 'select',
'#title' => $this
->t('Source Field'),
'#description' => $this
->t('Select the field on the source entity from which to inherit data.'),
'#options' => $source_entity_fields,
'#required' => TRUE,
'#default_value' => $field_inheritance
->sourceField(),
'#ajax' => [
'callback' => '::updateFieldOptions',
'wrapper' => 'field-inheritance-add-form--wrapper',
'event' => 'change',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Updating plugin options...'),
],
],
'#states' => [
'visible' => [
'select[name="source_entity_type"]' => [
'!value' => '',
],
'select[name="source_entity_bundle"]' => [
'!value' => '',
],
],
],
];
$form['destination'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Destination of Data'),
];
$form['destination']['destination_entity_type'] = [
'#type' => 'select',
'#title' => $this
->t('Destination Entity Type'),
'#description' => $this
->t('Select the destination entity type to which to inherit data.'),
'#options' => $entity_types,
'#required' => TRUE,
'#default_value' => $field_inheritance
->destinationEntityType(),
'#ajax' => [
'callback' => '::updateFieldOptions',
'wrapper' => 'field-inheritance-add-form--wrapper',
'event' => 'change',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Fetching destination options...'),
],
],
];
$form['destination']['destination_entity_bundle'] = [
'#type' => 'select',
'#title' => $this
->t('Destination Entity Bundle'),
'#description' => $this
->t('Select the destination entity bundle to which to inherit data.'),
'#options' => $destination_entity_bundles,
'#required' => TRUE,
'#default_value' => $field_inheritance
->destinationEntityBundle(),
'#ajax' => [
'callback' => '::updateFieldOptions',
'wrapper' => 'field-inheritance-add-form--wrapper',
'event' => 'change',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Fetching destination options...'),
],
],
'#states' => [
'visible' => [
'select[name="destination_entity_type"]' => [
'!value' => '',
],
],
],
];
$form['destination']['destination_field'] = [
'#type' => 'select',
'#title' => $this
->t('Destination Field'),
'#description' => $this
->t('(Optionally) Select the field on the destination entity to use during inheritance.'),
'#options' => $destination_entity_fields,
'#default_value' => $field_inheritance
->destinationField(),
'#states' => [
'visible' => [
'select[name="type"]' => [
'!value' => 'inherit',
],
'select[name="destination_entity_type"]' => [
'!value' => '',
],
'select[name="destination_entity_bundle"]' => [
'!value' => '',
],
],
'required' => [
'select[name="type"]' => [
'!value' => 'inherit',
],
'select[name="destination_entity_type"]' => [
'!value' => '',
],
'select[name="destination_entity_bundle"]' => [
'!value' => '',
],
],
],
];
$plugins = [];
foreach ($this->fieldInheritance
->getDefinitions() as $plugin_id => $plugin) {
$plugins[$plugin_id] = $plugin['name']
->__toString();
}
$global_plugins = [];
$prefered_plugin = '';
// If a source field is set, then hide plugins not applicable to that field
// type.
if (!empty($field_values['source_field'])) {
$source_definitions = $this->entityFieldManager
->getFieldDefinitions($field_values['source_entity_type'], $field_values['source_entity_bundle']);
foreach ($plugins as $key => $plugin) {
if ($key === '') {
continue;
}
$plugin_definition = $this->fieldInheritance
->getDefinition($key);
$field_types = $plugin_definition['types'];
if (!in_array('any', $field_types)) {
$prefered_plugin = $key;
if (!in_array($source_definitions[$field_values['source_field']]
->getType(), $field_types)) {
unset($plugins[$key]);
}
}
// Global plugins should not take precedent over more specific plugins.
if (in_array('any', $field_types)) {
if (empty($prefered_plugin)) {
$prefered_plugin = $key;
}
$global_plugins[$key] = $plugins[$key];
unset($plugins[$key]);
}
}
// If we have some global plugins, place them at the end of the list.
if (!empty($global_plugins)) {
$plugins = array_merge($plugins, $global_plugins);
}
$default_plugins = [
'' => $this
->t('- Select -'),
];
if (empty($plugins)) {
$plugins = $default_plugins;
}
$form['advanced'] = [
'#type' => 'details',
'#title' => $this
->t('Advanced'),
'#open' => TRUE,
];
$form['advanced']['plugin'] = [
'#type' => 'select',
'#title' => $this
->t('Inheritance Plugin'),
'#description' => $this
->t('Select the plugin used to perform the inheritance.'),
'#options' => $plugins,
'#required' => TRUE,
'#default_value' => $field_inheritance
->isNew() ? $prefered_plugin : $field_inheritance
->plugin() ?? $prefered_plugin,
];
}
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$values = $form_state
->getValues();
if (!empty($values['source_entity_type']) && !empty($values['destination_entity_type']) && !empty($values['source_entity_bundle']) && !empty($values['destination_entity_bundle'])) {
if (!empty($values['source_field']) && !empty($values['destination_field'])) {
$source_definitions = $this->entityFieldManager
->getFieldDefinitions($values['source_entity_type'], $values['source_entity_bundle']);
$destination_definitions = $this->entityFieldManager
->getFieldDefinitions($values['destination_entity_type'], $values['destination_entity_bundle']);
if ($source_definitions[$values['source_field']]
->getType() !== $destination_definitions[$values['destination_field']]
->getType()) {
$message = $this
->t('Source and destination field definition types must be the same to inherit data. Source - @source_name type: @source_type. Destination - @destination_name type: @destination_type', [
'@source_name' => $values['source_field'],
'@source_type' => $source_definitions[$values['source_field']]
->getType(),
'@destination_name' => $values['destination_field'],
'@destination_type' => $destination_definitions[$values['destination_field']]
->getType(),
]);
$form_state
->setErrorByName('source_field', $message);
$form_state
->setErrorByName('destination_field', $message);
}
$plugin_definition = $this->fieldInheritance
->getDefinition($values['plugin']);
$field_types = $plugin_definition['types'];
if (!in_array('any', $field_types) && !in_array($source_definitions[$values['source_field']]
->getType(), $field_types)) {
$message = $this
->t('The selected plugin @plugin does not support @source_type fields. The supported field types are: @field_types', [
'@plugin' => $values['plugin'],
'@source_type' => $source_definitions[$values['source_field']]
->getType(),
'@field_types' => implode(',', $field_types),
]);
$form_state
->setErrorByName('source_field', $message);
$form_state
->setErrorByName('plugin', $message);
}
if ($values['source_entity_type'] == $values['destination_entity_type'] && $values['source_entity_bundle'] == $values['destination_entity_bundle']) {
$message = $this
->t('You cannot inherit if the source and destination entities and bundles are the same.');
$form_state
->setErrorByName('source_entity_bundle', $message);
$form_state
->setErrorByName('destination_entity_bundle', $message);
}
}
}
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$field_inheritance = $this->entity;
$field_inheritance
->setSourceEntityType($values['source_entity_type']);
$field_inheritance
->setSourceEntityBundle($values['source_entity_bundle']);
$field_inheritance
->setSourceField($values['source_field']);
$field_inheritance
->setDestinationEntityType($values['destination_entity_type']);
$field_inheritance
->setDestinationEntityBundle($values['destination_entity_bundle']);
$field_inheritance
->setDestinationField($values['destination_field']);
$status = $field_inheritance
->save();
switch ($status) {
case SAVED_NEW:
$this->messenger
->addMessage($this
->t('Created the %label field inheritance.', [
'%label' => $field_inheritance
->label(),
]));
break;
default:
$this->messenger
->addMessage($this
->t('Saved the %label field inheritance.', [
'%label' => $field_inheritance
->label(),
]));
}
$this->entityFieldManager
->clearCachedFieldDefinitions();
$form_state
->setRedirectUrl($field_inheritance
->toUrl('collection'));
}
/**
* AJAX Callback: Update Field Options.
*/
public function updateFieldOptions(array &$form, FormStateInterface $form_state) {
$form_state
->setRebuild();
$response = new AjaxResponse();
$response
->addCommand(new HtmlCommand('#field-inheritance-add-form--wrapper', $form));
return $response;
}
/**
* Determines if the field inheritance already exists.
*
* @param string|int $entity_id
* The entity ID.
* @param array $element
* The form element.
*
* @return bool
* TRUE if the display mode exists, FALSE otherwise.
*/
public function exists($entity_id, array $element) {
if (!empty($this->entity->destination_entity_type) && !empty($this->entity->destination_entity_bundle)) {
$id = $this->entity->destination_entity_type . '_' . $this->entity->destination_entity_bundle . '_' . $entity_id;
$return = (bool) $this->entityTypeManager
->getStorage($this->entity
->getEntityTypeId())
->getQuery()
->condition('id', $id)
->execute();
return $return;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 being used by this form. | 7 |
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 an array of supported actions for the current entity form. | 29 |
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 |
Builds an updated entity object based upon the submitted form values. Overrides EntityFormInterface:: |
2 |
EntityForm:: |
public | function |
Form constructor. Overrides FormInterface:: |
10 |
EntityForm:: |
protected | function | Copies top-level form values to entity properties | 7 |
EntityForm:: |
public | function |
Returns a string identifying the base form. Overrides BaseFormIdInterface:: |
5 |
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 | Initialize the form state and the entity before the first form build. | 3 |
EntityForm:: |
protected | function | Prepares the entity object before the form is built first. | 3 |
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 |
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 FormInterface:: |
17 |
EntityForm:: |
public | function | ||
EntityForm:: |
public | function | ||
FieldInheritanceForm:: |
protected | property | The entity field manager service. | |
FieldInheritanceForm:: |
protected | property | The entity type bundle info service. | |
FieldInheritanceForm:: |
protected | property |
The entity type manager service. Overrides EntityForm:: |
|
FieldInheritanceForm:: |
protected | property | The field inheritance plugin manager. | |
FieldInheritanceForm:: |
protected | property |
The messenger service. Overrides MessengerTrait:: |
|
FieldInheritanceForm:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
1 |
FieldInheritanceForm:: |
public | function | Determines if the field inheritance already exists. | |
FieldInheritanceForm:: |
public | function |
Gets the actual form array to be built. Overrides EntityForm:: |
|
FieldInheritanceForm:: |
public | function |
Form submission handler for the 'save' action. Overrides EntityForm:: |
|
FieldInheritanceForm:: |
public | function | AJAX Callback: Update Field Options. | |
FieldInheritanceForm:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
FieldInheritanceForm:: |
public | function | Construct an FieldInheritanceForm. | 1 |
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:: |
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. |