You are here

class EdgeEntityTitleProvider in Apigee Edge 8

Provides default page titles for Apigee Edge entities.

Hierarchy

Expanded class hierarchy of EdgeEntityTitleProvider

1 file declares its use of EdgeEntityTitleProvider
TeamTitleProvider.php in modules/apigee_edge_teams/src/Entity/TeamTitleProvider.php

File

src/Entity/EdgeEntityTitleProvider.php, line 30

Namespace

Drupal\apigee_edge\Entity
View source
class EdgeEntityTitleProvider extends EntityController {

  /**
   * {@inheritdoc}
   */
  public function title(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
    if ($entity = $this
      ->doGetEntity($route_match, $_entity)) {
      return $this
        ->t('@label @entity_type', [
        '@label' => $entity
          ->label(),
        '@entity_type' => mb_strtolower($this->entityTypeManager
          ->getDefinition($entity
          ->getEntityTypeId())
          ->getSingularLabel()),
      ]);
    }
    return parent::title($route_match, $_entity);
  }

  /**
   * {@inheritdoc}
   */
  public function editTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
    if ($entity = $this
      ->doGetEntity($route_match, $_entity)) {
      return $this
        ->t('Edit %label @entity_type', [
        '%label' => $entity
          ->label(),
        '@entity_type' => mb_strtolower($this->entityTypeManager
          ->getDefinition($entity
          ->getEntityTypeId())
          ->getSingularLabel()),
      ]);
    }
    return parent::editTitle($route_match, $_entity);
  }

  /**
   * {@inheritdoc}
   */
  public function deleteTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
    if ($entity = $this
      ->doGetEntity($route_match, $_entity)) {

      // TODO Investigate why entity delete forms (confirm forms) does not
      // display this as a page title. This issue also existed before.
      return $this
        ->t('Delete %label @entity_type', [
        '%label' => $entity
          ->label(),
        '@entity_type' => mb_strtolower($this->entityTypeManager
          ->getDefinition($entity
          ->getEntityTypeId())
          ->getSingularLabel()),
      ]);
    }
    return parent::deleteTitle($route_match, $_entity);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EdgeEntityTitleProvider::deleteTitle public function Provides a generic delete title callback. Overrides EntityController::deleteTitle
EdgeEntityTitleProvider::editTitle public function Provides a generic edit title callback. Overrides EntityController::editTitle
EdgeEntityTitleProvider::title public function Provides a generic title callback for a single entity. Overrides EntityController::title
EntityController::$entityRepository protected property The entity repository.
EntityController::$entityTypeBundleInfo protected property The entity type bundle info.
EntityController::$entityTypeManager protected property The entity manager.
EntityController::$renderer protected property The renderer.
EntityController::addBundleTitle public function Provides a generic add title callback for entities with bundles.
EntityController::addPage public function Displays add links for the available bundles.
EntityController::addTitle public function Provides a generic add title callback for an entity type.
EntityController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
EntityController::doGetEntity protected function Determines the entity.
EntityController::loadBundleDescriptions protected function Expands the bundle information with descriptions, if known.
EntityController::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
EntityController::__construct public function Constructs a new EntityController.
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.