You are here

class GridStackVariantForm in GridStack 8.2

Extends base form for gridstack instance configuration form.

Hierarchy

Expanded class hierarchy of GridStackVariantForm

File

modules/gridstack_ui/src/Form/GridStackVariantForm.php, line 13

Namespace

Drupal\gridstack_ui\Form
View 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

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EntityForm::$entity protected property The entity being used by this form. 7
EntityForm::$entityTypeManager protected property The entity type manager. 3
EntityForm::$moduleHandler protected property The module handler service.
EntityForm::$operation protected property The name of the current operation.
EntityForm::$privateEntityManager private property The entity manager.
EntityForm::actions protected function Returns an array of supported actions for the current entity form. 29
EntityForm::actionsElement protected function Returns the action form element for the current entity form.
EntityForm::afterBuild public function Form element #after_build callback: Updates the entity with submitted data.
EntityForm::buildForm public function Form constructor. Overrides FormInterface::buildForm 10
EntityForm::copyFormValuesToEntity protected function Copies top-level form values to entity properties 7
EntityForm::getBaseFormId public function Returns a string identifying the base form. Overrides BaseFormIdInterface::getBaseFormId 5
EntityForm::getEntity public function Gets the form entity. Overrides EntityFormInterface::getEntity
EntityForm::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface::getEntityFromRouteMatch 1
EntityForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId 10
EntityForm::getOperation public function Gets the operation identifying the form. Overrides EntityFormInterface::getOperation
EntityForm::init protected function Initialize the form state and the entity before the first form build. 3
EntityForm::prepareEntity protected function Prepares the entity object before the form is built first. 3
EntityForm::prepareInvokeAll protected function Invokes the specified prepare hook variant.
EntityForm::processForm public function Process callback: assigns weights and hides extra fields.
EntityForm::setEntity public function Sets the form entity. Overrides EntityFormInterface::setEntity
EntityForm::setEntityManager public function Sets the entity manager for this form. Overrides EntityFormInterface::setEntityManager
EntityForm::setEntityTypeManager public function Sets the entity type manager for this form. Overrides EntityFormInterface::setEntityTypeManager
EntityForm::setModuleHandler public function Sets the module handler for this form. Overrides EntityFormInterface::setModuleHandler
EntityForm::setOperation public function Sets the operation for this form. Overrides EntityFormInterface::setOperation
EntityForm::submitForm 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::submitForm 17
EntityForm::__get public function
EntityForm::__set public function
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
GridStackForm::getDescription protected function Returns form item description.
GridStackForm::optionsForm protected function Sets up the options form.
GridStackForm::previewForm protected function Sets up the preview form.
GridStackForm::settingsForm protected function Sets up the settings form.
GridStackFormBase::$adminCss protected property The flag whether the admin CSS is enabled, or not.
GridStackFormBase::$blazyAdmin protected property The blazy manager service.
GridStackFormBase::$breakpointCount protected property The total breakpoint count.
GridStackFormBase::$cssConfig protected property The jsonified config for css-driven layouts.
GridStackFormBase::$default protected property The GridStack default entity.
GridStackFormBase::$engine protected property The layout engine.
GridStackFormBase::$fileSystem protected property The file system service.
GridStackFormBase::$framework protected property The active CSS framework.
GridStackFormBase::$grids protected property The main grids.
GridStackFormBase::$gridStack protected property The gridstack instance to distinguish from the current entity.
GridStackFormBase::$html5Ac protected property The flag whether to use HTML5 autocomplete suggestions, or not.
GridStackFormBase::$iconBreakpoint protected property Which breakpoint to generate icon from.
GridStackFormBase::$isDefault protected property The flag whether the entity is default, or not.
GridStackFormBase::$jsConfig protected property The jsonified config for js-driven layouts.
GridStackFormBase::$jsSettings protected property The required settings by admin preview.
GridStackFormBase::$manager protected property The GridStack manager service.
GridStackFormBase::$nestedGrids protected property The main grids.
GridStackFormBase::$nestedSettings protected property The CSS framework settings.
GridStackFormBase::$options protected property The options.
GridStackFormBase::$regionSuggestions protected property The region suggestions.
GridStackFormBase::$settings protected property The active settings.
GridStackFormBase::$smallestBreakpoint protected property The smallest breakpoint can be SM for Foundation, XS for the rest.
GridStackFormBase::$useNested protected property The flag whether the nested option (framework) is enabled, or not.
GridStackFormBase::breakpointElements protected function Defines breakpoints form adopted from Blazy deprecated methods.
GridStackFormBase::create public static function Instantiates a new instance of this class. Overrides FormBase::create
GridStackFormBase::getColumnOptions protected function Returns the supported columns.
GridStackFormBase::getNestedSettings protected function Returns the CSS settings.
GridStackFormBase::getNodes protected function Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes.
GridStackFormBase::getNodesNested protected function Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes.
GridStackFormBase::getRegionSuggestions protected function Returns the region suggestions.
GridStackFormBase::getUserInputValues protected static function Returns user input values.
GridStackFormBase::gridStack protected function Returns the gridstack instance.
GridStackFormBase::initEngine protected function Initializes the layout engine.
GridStackFormBase::jsonForm protected function Returns the json form.
GridStackFormBase::jsonify protected function Convert the config into a JSON object to reduce logic at frontend.
GridStackFormBase::massageSettings protected function Massages the settings specific for when CSS Framework is disabled.
GridStackFormBase::regionForm protected function Returns the region form.
GridStackFormBase::saveImage protected function Saves the icon based on the current grid display.
GridStackFormBase::setGridStack protected function Sets the gridstack instance.
GridStackFormBase::useFramework protected function Returns TRUE if should use framework.
GridStackFormBase::validateBreakpointForm protected function Validate breakpoint form.
GridStackFormBase::validateForm public function Form validation handler. Overrides FormBase::validateForm
GridStackVariantForm::$isVariant protected property Defines the variant. Overrides GridStackFormBase::$isVariant
GridStackVariantForm::$machineName protected property Defines the machine name. Overrides GridStackFormBase::$machineName
GridStackVariantForm::$niceName protected property Defines the nice name. Overrides GridStackFormBase::$niceName
GridStackVariantForm::buildEntity public function Builds an updated entity object based upon the submitted form values. Overrides EntityForm::buildEntity
GridStackVariantForm::closeVariant public function Callback for cancelling a layout variant.
GridStackVariantForm::deleteVariant public function Callback for deleting a layout variant.
GridStackVariantForm::duplicateVariant public function Callback for duplicating a layout variant.
GridStackVariantForm::form public function Gets the actual form array to be built. Overrides GridStackForm::form
GridStackVariantForm::getApplicableBreakpoints protected function Returns the applicable breakpoints. Overrides GridStackFormBase::getApplicableBreakpoints
GridStackVariantForm::revertVariant public function Callback for reverting a layout variant to source layout.
GridStackVariantForm::save public function Overrides Drupal\Core\Entity\EntityFormController::save(). Overrides GridStackFormBase::save
GridStackVariantForm::saveVariant public function Callback for saving a layout variant draft.
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.