You are here

public function EntityFormModeBase::pageTitle in Form mode manager 8

The _title_callback for the entity.add routes.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

string $operation: Name of current context operation to display title (create/edit).

Return value

string The page title.

2 calls to EntityFormModeBase::pageTitle()
EntityFormModeBase::addPageTitle in src/Controller/EntityFormModeBase.php
The _title_callback for the entity.add routes.
EntityFormModeBase::editPageTitle in src/Controller/EntityFormModeBase.php
The _title_callback for the entity.add routes.
1 method overrides EntityFormModeBase::pageTitle()
UserFormModeController::pageTitle in src/Controller/UserFormModeController.php
The _title_callback for the entity.add routes.

File

src/Controller/EntityFormModeBase.php, line 334

Class

EntityFormModeBase
Controller for entity form mode support.

Namespace

Drupal\form_mode_manager\Controller

Code

public function pageTitle(RouteMatchInterface $route_match, $operation) {

  /** @var \Drupal\Core\Config\Entity\ConfigEntityBase $entity_storage */
  $entity_storage = $this
    ->getEntityBundle($route_match);
  $form_mode_label = $route_match
    ->getRouteObject()
    ->getOption('parameters')['form_mode']['label'];
  return $this
    ->t('@op @name as @form_mode_label', [
    '@name' => $entity_storage
      ->label(),
    '@form_mode_label' => $form_mode_label,
    '@op' => $operation,
  ]);
}