You are here

public function TransactionController::transactionAddTitle in Transaction 8

Provides a title callback for transaction creation form.

Parameters

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

\Drupal\transaction\TransactionTypeInterface $transaction_type: (optional) The type of the new transaction.

\Drupal\Core\Entity\ContentEntityInterface $target_entity: (optional) The target entity for the new transaction.

Return value

string The title for the transaction creation form.

1 string reference to 'TransactionController::transactionAddTitle'
transaction.routing.yml in ./transaction.routing.yml
transaction.routing.yml

File

src/Controller/TransactionController.php, line 99

Class

TransactionController
Provides title callbacks for transaction entities.

Namespace

Drupal\transaction\Controller

Code

public function transactionAddTitle(RouteMatchInterface $route_match, TransactionTypeInterface $transaction_type = NULL, ContentEntityInterface $target_entity = NULL) {
  if ($target_entity) {
    $title = $transaction_type ? $this
      ->t('Create %type transaction for %target', [
      '%type' => $transaction_type
        ->label(),
      '%target' => $target_entity
        ->label(),
    ]) : $this
      ->t('Create transaction for %target', [
      '%target' => $target_entity
        ->label(),
    ]);
  }
  else {
    $title = $transaction_type ? $this
      ->t('Create %type transaction', [
      '%type' => $transaction_type
        ->label(),
    ]) : $this
      ->t('Create transaction');
  }
  return $title;
}