class GridStackVariantForm in GridStack 8.2
Extends base form for gridstack instance configuration 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\gridstack_ui\Form\GridStackFormBase
- class \Drupal\gridstack_ui\Form\GridStackForm
- class \Drupal\gridstack_ui\Form\GridStackVariantForm
- class \Drupal\gridstack_ui\Form\GridStackForm
- class \Drupal\gridstack_ui\Form\GridStackFormBase
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of GridStackVariantForm
File
- modules/
gridstack_ui/ src/ Form/ GridStackVariantForm.php, line 13
Namespace
Drupal\gridstack_ui\FormView source
class GridStackVariantForm extends GridStackForm {
/**
* {@inheritdoc}
*/
protected $isVariant = TRUE;
/**
* {@inheritdoc}
*/
protected $niceName = 'GridStackVariant';
/**
* {@inheritdoc}
*/
protected $machineName = 'gridstack_variant';
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form['#attributes']['class'][] = 'form--gridstack-variant';
$form['#attached']['library'][] = 'gridstack/admin_variant';
$source = $this->entity
->source();
$gridstack = $source ? GridStack::load($source) : NULL;
// @todo remove after another check.
if ($source && $gridstack) {
$this
->setGridStack($gridstack);
}
$form = parent::form($form, $form_state);
if (!$this->entity
->source()) {
return [];
}
unset($form['options']['settings'], $form['options']['use_framework']);
$form['source'] = [
'#type' => 'hidden',
'#default_value' => $this->entity
->source(),
];
$description = $this
->t('Height is pre-determined by grids, not contents.');
if ($gridstack && $gridstack
->isFramework()) {
$description = $this
->t('Height is determined later by contents, not grids. Floating grid rules apply. Index order matters to float correctly.');
}
$id = $this->entity
->id();
$label = $this->entity
->label();
$pid = $gridstack ? $gridstack->id : NULL;
$form_wrapper_id = GridStackDefault::variantWrapperId($id);
$request_uri = $this
->getRequest()
->getRequestUri();
$parts = array_filter(explode('/', $request_uri));
$gid = NULL;
$pub = $this
->getRequest()->query
->get('pub', NULL);
$label_dup = $this
->getRequest()->query
->get('label', NULL);
$applied = !empty($pub) && $pub == $id;
$applied_differently = !empty($pub) && $pub != $id;
$variant_pub = $pub ? GridStackVariant::load($pub) : NULL;
// Extracts gid from URL.
$is_ajax = $parts[1] == 'gridstack';
if (isset($parts[4]) && $parts[3] == $source) {
$gid = $parts[4];
}
$links = [];
$config = [
'vid' => $id,
'optionset' => $pid,
'gid' => $gid,
'pub' => $pub,
];
$duplicated_vid = $form_state
->get('new_vid') ?: $this->entity
->getRandomizedId();
$input = $form_state
->getUserInput();
if (empty($duplicated_vid)) {
$duplicated_vid = isset($input['new_vid']) ? $input['new_vid'] : '';
}
if ($duplicated_vid) {
$config['dup'] = $duplicated_vid;
}
if ($gridstack && $gid) {
$links = $this->manager
->stylizer()
->builder($config)
->getVariantLinks($config, $gridstack);
}
// @todo remove once duplicate action works correctly.
$duplicate = isset($links['duplicate']) ? $links['duplicate'] : [];
if ($duplicate) {
$duplicate['#title'] = $this
->t('Save as New');
}
$form['#prefix'] = '<div id="' . $form_wrapper_id . '">';
$form['#suffix'] = '</div>';
$form['#attributes']['data-gs-gid'] = $gid;
$form['variant_actions'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'form--gridstack-variant__actions',
],
],
'#tree' => TRUE,
'#weight' => -100,
'#settings' => $config,
'#access' => $is_ajax,
'actions' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'btn-group',
],
],
'close' => [
'#type' => 'button',
'#value' => $this
->t('Close'),
'#name' => 'close',
'#ajax' => [
'callback' => [
$this,
'closeVariant',
],
'effect' => 'fade',
'wrapper' => GridStackDefault::variantWrapperId($gid),
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Closing.'),
],
],
'#attributes' => [
'class' => [
'btn',
'btn-dark',
'btn--variant-close',
],
],
],
'delete' => [
'#type' => 'button',
'#value' => $this
->t('Delete'),
'#name' => 'delete',
'#ajax' => [
'callback' => [
$this,
'deleteVariant',
],
'effect' => 'fade',
'wrapper' => $form_wrapper_id,
],
'#attributes' => [
'class' => [
'btn',
'btn-danger',
'btn--variant-delete',
],
'data-gs-vid' => '',
'data-gs-variant-ajax' => 'delete',
'data-gs-variant-message' => $this
->t('Deleting and reverting'),
],
],
'revert' => [
'#type' => 'button',
'#value' => $this
->t('Revert'),
'#name' => 'revert',
'#access' => $applied || $applied_differently,
'#ajax' => [
'callback' => [
$this,
'revertVariant',
],
'effect' => 'fade',
'wrapper' => $form_wrapper_id,
],
'#attributes' => [
'class' => [
'btn',
'btn-warning',
'btn--variant-revert',
],
'data-gs-vid' => '',
'data-gs-variant-ajax' => 'revert',
'data-gs-variant-message' => $this
->t('Reverting'),
],
],
'duplicate' => $duplicate,
/* @todo use this when things are fixed.
'duplicate' => [
'#type' => 'button',
'#value' => $this->t('Save as New'),
'#name' => 'duplicate',
'#ajax' => [
'callback' => [$this, 'duplicateVariant'],
'effect' => 'fade',
'wrapper' => GridStackDefault::variantWrapperId($gid),
'method' => 'html',
'progress' => [
'type' => 'throbber',
'message' => $this->t('Duplicating.'),
],
],
'#attributes' => [
'class' => ['btn', 'btn-info', 'btn--variant-duplicate'],
'data-gs-vid' => '',
'data-gs-variant-nojs' => 'duplicate',
'data-gs-variant-message' => $this->t('Saving as new'),
'data-gs-update-icon' => 1,
],
// @todo bad: '#limit_validation_errors' => [],
],
*/
'save' => [
'#type' => 'button',
'#value' => $this
->t('Save'),
'#name' => 'save',
'#ajax' => [
'callback' => [
$this,
'saveVariant',
],
'effect' => 'fade',
'wrapper' => GridStackDefault::variantWrapperId($gid),
'method' => 'html',
'progress' => [
'type' => 'throbber',
'message' => $this
->t('Saving.'),
],
],
'#attributes' => [
'class' => [
'btn',
'btn-success',
'btn--variant-save',
],
'data-gs-vid' => $id,
'data-gs-variant-nojs' => 'save',
'data-gs-variant-message' => $this
->t('Saving'),
'data-gs-update-icon' => 1,
],
],
'apply_trigger' => [
'#type' => 'submit',
'#value' => $this
->t('Apply'),
'#name' => 'apply_trigger',
'#attributes' => [
'class' => [
'btn',
'btn-success',
'btn--variant-apply-trigger',
],
'data-gs-vid' => $id,
'data-gs-variant-trigger' => 'apply',
'data-gs-variant-message' => $this
->t('Applying variant'),
'data-gs-update-icon' => 1,
],
],
'apply' => [
'#type' => 'button',
'#value' => $this
->t('Apply'),
'#name' => 'apply',
'#ajax' => [
'callback' => [
$this,
'saveVariant',
],
'effect' => 'fade',
'wrapper' => $form_wrapper_id,
'progress' => [
'type' => 'fullscreen',
'message' => $this
->t('Applying variant.'),
],
],
'#attributes' => [
'class' => [
'btn',
'btn--variant-apply',
'visually-hidden',
],
'data-gs-vid' => $id,
'data-gs-variant-ajax' => 'apply',
'data-gs-variant-message' => $this
->t('Applying'),
'data-gs-update-icon' => 1,
],
],
'select' => isset($links['select']) ? $links['select'] : [],
],
'update' => [
'#type' => 'submit',
'#value' => $this
->t('Update Icon'),
'#name' => 'update',
'#attributes' => [
'class' => [
'btn',
'btn-secondary',
'btn--variant-update',
],
'data-gs-vid' => $id,
'data-gs-variant-js' => 'update',
'data-gs-variant-message' => $this
->t('Updating'),
'data-gs-update-icon' => 1,
],
],
'description' => [
'#markup' => '<p><small>' . $description . '</small></p>',
'#allowed_tags' => [
'p',
'small',
],
],
];
$css = $this->manager
->stylizer()
->style()
->getVariantClass($label);
$label_suffix = $id;
// Adjust few things for Layout Builder AJAX displays.
if ($is_ajax) {
$label_suffix .= ' (';
$label_suffix .= $applied ? $this
->t('applied') : $this
->t('draft -- not applied');
if ($applied_differently && $variant_pub) {
$label_suffix .= $this
->t(', currently applied: @label', [
'@label' => $variant_pub
->label(),
]);
}
$label_suffix .= ')';
$form['actions']['#access'] = FALSE;
$form['description']['#access'] = FALSE;
unset($form['label']['#prefix'], $form['name']['#suffix']);
$form['label']['#attributes']['class'][] = 'form-text--label-variant';
if ($label_dup) {
$form_state
->setValue('label', $label_dup);
$form['label']['#default_value'] = $label_dup;
}
}
$form['name']['#machine_name']['source'] = [
'id',
];
$form['name']['#wrapper_attributes']['class'][] = 'visually-hidden';
$form['label']['#description'] = $this
->t('Label for this variant, also used as CSS class for unique styling: <code>@css</code>. <br>Changing a variant will change it everywhere else. To be unique, clone and give unique memorable label accordingly.', [
'@css' => $css,
]);
$form['label']['#field_suffix'] = $label_suffix;
$form['label']['#weight'] = -99;
$form['label']['#title_display'] = 'visually-hidden';
$form['label']['#attributes']['placeholder'] = $this
->t('Label');
if ($gridstack && ($uri = $gridstack
->getIconUri())) {
$icon = [
'#theme' => 'image',
'#uri' => $uri,
'#alt' => $this
->t('Thumbnail'),
];
if ($this
->currentUser()
->hasPermission('administer gridstack')) {
$image = $icon;
$icon = [
'#type' => 'link',
'#url' => $gridstack
->toUrl('edit-form'),
'#title' => [
'#markup' => $this->manager
->getRenderer()
->render($image),
'#allowed_tags' => [
'img',
],
],
];
}
$form['screenshot_original'] = [
'#type' => 'container',
'icon' => $icon,
'#weight' => 100,
'#attributes' => [
'class' => [
'form--gridstack__screenshot',
'form--gridstack__screenshot--original',
],
],
];
}
return $form;
}
/**
* Callback for cancelling a layout variant.
*/
public function closeVariant(array $form, FormStateInterface $form_state) {
$config = $form['variant_actions']['#settings'];
$gridstack = $this
->gridStack();
$editor = $this->manager
->stylizer()
->builder()
->getVariantEditor($config, $gridstack);
return $editor['form'];
}
/**
* Callback for deleting a layout variant.
*/
public function deleteVariant(array $form, FormStateInterface $form_state) {
$this->entity
->delete();
return $form;
}
/**
* Callback for reverting a layout variant to source layout.
*/
public function revertVariant(array $form, FormStateInterface $form_state) {
return $form;
}
/**
* Callback for duplicating a layout variant.
*
* @fixme, no icon generated, duplicate worflow is not good.
*/
public function duplicateVariant(array &$form, FormStateInterface $form_state) {
$entity = $this->entity;
$id = $entity
->getRandomizedId();
$form_state
->set('new_vid', $id);
$label = $form_state
->getValue('label') ?: $entity
->getLabelFromId($id);
$options = $entity
->getOptions();
unset($options['icon']);
$clone = $entity
->createDuplicateVariant($id, $label, $options);
$this
->setEntity($clone);
$this->entity
->save();
$id = $this->entity
->id();
$form['variant_actions']['actions']['duplicate']['#attributes']['disabled'] = TRUE;
$form['label']['#field_suffix'] = $id;
$this
->validateForm($form, $form_state);
$this
->save($form, $form_state);
$form_wrapper_id = GridStackDefault::variantWrapperId($id);
$form['#prefix'] = '<div id="' . $form_wrapper_id . '">';
foreach ([
'cancel',
'duplicate',
'revert',
'update',
'apply',
'save',
] as $key) {
$form['variant_actions']['actions'][$key]['#attributes']['data-gs-vid'] = $id;
if (!in_array($key, [
'cancel',
'update',
])) {
$form['variant_actions']['actions'][$key]['#ajax']['wrapper'] = $form_wrapper_id;
}
}
return $form;
}
/**
* Callback for saving a layout variant draft.
*/
public function saveVariant(array &$form, FormStateInterface &$form_state) {
$this
->validateForm($form, $form_state);
$this
->save($form, $form_state);
return $form;
}
/**
* {@inheritdoc}
*/
protected function getApplicableBreakpoints() {
$gridstack = $this
->gridStack();
$breakpoints = $gridstack ? [
$gridstack
->getLastBreakpointKey(),
] : [
'lg',
];
// Allows alterations by those who can afford complication.
$this->manager
->getModuleHandler()
->alter('gridstack_variant_applicable_breakpoints', $breakpoints, $gridstack, $this->engine, $this
->currentUser());
return $breakpoints;
}
/**
* {@inheritdoc}
*/
public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = parent::buildEntity($form, $form_state);
$request = $this
->getRequest();
$request_uri = $request
->getRequestUri();
$source = $entity
->source();
if (empty($source)) {
if ($this->operation == 'add' || $this->operation == 'duplicate') {
$args = array_filter(explode('/', $request_uri));
// Given non-ajax URL: /admin/structure/gridstack...
if (isset($args[3]) && $args[3] == 'gridstack') {
// The last parameter is add or duplicate, remove.
array_pop($args);
$source = end($args);
if ($gridstack = GridStack::load($source)) {
$entity
->set('source', $source);
$this
->setGridStack($gridstack);
}
}
}
}
return $entity;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$this->entity
->set('source', $this->entity
->source());
parent::save($form, $form_state);
}
}
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 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 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 |
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 | ||
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. | |
GridStackForm:: |
protected | function | Returns form item description. | |
GridStackForm:: |
protected | function | Sets up the options form. | |
GridStackForm:: |
protected | function | Sets up the preview form. | |
GridStackForm:: |
protected | function | Sets up the settings form. | |
GridStackFormBase:: |
protected | property | The flag whether the admin CSS is enabled, or not. | |
GridStackFormBase:: |
protected | property | The blazy manager service. | |
GridStackFormBase:: |
protected | property | The total breakpoint count. | |
GridStackFormBase:: |
protected | property | The jsonified config for css-driven layouts. | |
GridStackFormBase:: |
protected | property | The GridStack default entity. | |
GridStackFormBase:: |
protected | property | The layout engine. | |
GridStackFormBase:: |
protected | property | The file system service. | |
GridStackFormBase:: |
protected | property | The active CSS framework. | |
GridStackFormBase:: |
protected | property | The main grids. | |
GridStackFormBase:: |
protected | property | The gridstack instance to distinguish from the current entity. | |
GridStackFormBase:: |
protected | property | The flag whether to use HTML5 autocomplete suggestions, or not. | |
GridStackFormBase:: |
protected | property | Which breakpoint to generate icon from. | |
GridStackFormBase:: |
protected | property | The flag whether the entity is default, or not. | |
GridStackFormBase:: |
protected | property | The jsonified config for js-driven layouts. | |
GridStackFormBase:: |
protected | property | The required settings by admin preview. | |
GridStackFormBase:: |
protected | property | The GridStack manager service. | |
GridStackFormBase:: |
protected | property | The main grids. | |
GridStackFormBase:: |
protected | property | The CSS framework settings. | |
GridStackFormBase:: |
protected | property | The options. | |
GridStackFormBase:: |
protected | property | The region suggestions. | |
GridStackFormBase:: |
protected | property | The active settings. | |
GridStackFormBase:: |
protected | property | The smallest breakpoint can be SM for Foundation, XS for the rest. | |
GridStackFormBase:: |
protected | property | The flag whether the nested option (framework) is enabled, or not. | |
GridStackFormBase:: |
protected | function | Defines breakpoints form adopted from Blazy deprecated methods. | |
GridStackFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
|
GridStackFormBase:: |
protected | function | Returns the supported columns. | |
GridStackFormBase:: |
protected | function | Returns the CSS settings. | |
GridStackFormBase:: |
protected | function | Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes. | |
GridStackFormBase:: |
protected | function | Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes. | |
GridStackFormBase:: |
protected | function | Returns the region suggestions. | |
GridStackFormBase:: |
protected static | function | Returns user input values. | |
GridStackFormBase:: |
protected | function | Returns the gridstack instance. | |
GridStackFormBase:: |
protected | function | Initializes the layout engine. | |
GridStackFormBase:: |
protected | function | Returns the json form. | |
GridStackFormBase:: |
protected | function | Convert the config into a JSON object to reduce logic at frontend. | |
GridStackFormBase:: |
protected | function | Massages the settings specific for when CSS Framework is disabled. | |
GridStackFormBase:: |
protected | function | Returns the region form. | |
GridStackFormBase:: |
protected | function | Saves the icon based on the current grid display. | |
GridStackFormBase:: |
protected | function | Sets the gridstack instance. | |
GridStackFormBase:: |
protected | function | Returns TRUE if should use framework. | |
GridStackFormBase:: |
protected | function | Validate breakpoint form. | |
GridStackFormBase:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
GridStackVariantForm:: |
protected | property |
Defines the variant. Overrides GridStackFormBase:: |
|
GridStackVariantForm:: |
protected | property |
Defines the machine name. Overrides GridStackFormBase:: |
|
GridStackVariantForm:: |
protected | property |
Defines the nice name. Overrides GridStackFormBase:: |
|
GridStackVariantForm:: |
public | function |
Builds an updated entity object based upon the submitted form values. Overrides EntityForm:: |
|
GridStackVariantForm:: |
public | function | Callback for cancelling a layout variant. | |
GridStackVariantForm:: |
public | function | Callback for deleting a layout variant. | |
GridStackVariantForm:: |
public | function | Callback for duplicating a layout variant. | |
GridStackVariantForm:: |
public | function |
Gets the actual form array to be built. Overrides GridStackForm:: |
|
GridStackVariantForm:: |
protected | function |
Returns the applicable breakpoints. Overrides GridStackFormBase:: |
|
GridStackVariantForm:: |
public | function | Callback for reverting a layout variant to source layout. | |
GridStackVariantForm:: |
public | function |
Overrides Drupal\Core\Entity\EntityFormController::save(). Overrides GridStackFormBase:: |
|
GridStackVariantForm:: |
public | function | Callback for saving a layout variant draft. | |
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. |