class TeamInvitationRouteProvider in Apigee Edge 8
Provides entity routes for team_invitation.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\apigee_edge_teams\Entity\TeamInvitationRouteProvider uses TeamRoutingHelperTrait
Expanded class hierarchy of TeamInvitationRouteProvider
File
- modules/
apigee_edge_teams/ src/ Entity/ TeamInvitationRouteProvider.php, line 30
Namespace
Drupal\apigee_edge_teams\EntityView source
class TeamInvitationRouteProvider extends DefaultHtmlRouteProvider {
use TeamRoutingHelperTrait;
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
$entity_type_id = $entity_type
->id();
if ($delete_form = $this
->getDeleteFormRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.delete_form", $delete_form);
}
if ($accept_form = $this
->getAcceptFormRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.accept_form", $accept_form);
}
if ($decline_form = $this
->getDeclineFormRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.decline_form", $decline_form);
}
if ($resend_form = $this
->getResentFormRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.resend_form", $resend_form);
}
return $collection;
}
/**
* Gets the delete-form route for team_invitation.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getDeleteFormRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('delete-form')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('delete-form'));
$route
->setDefault('_entity_form', "{$entity_type_id}.delete");
$route
->setDefault('_title_callback', TeamInvitationTitleProvider::class . '::deleteTitle');
$route
->setDefault('entity_type_id', $entity_type_id);
$this
->ensureTeamParameter($route);
$route
->setRequirement('_entity_access', "{$entity_type_id}.delete");
return $route;
}
}
/**
* Gets the notify-form route for team_invitation.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getResentFormRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('resend-form')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('resend-form'));
$route
->setDefault('_entity_form', "{$entity_type_id}.resend");
$route
->setDefault('_title_callback', TeamInvitationTitleProvider::class . '::resendTitle');
$route
->setDefault('entity_type_id', $entity_type_id);
$this
->ensureTeamParameter($route);
$route
->setRequirement('_entity_access', "{$entity_type_id}.resend");
return $route;
}
}
/**
* Gets the accept-form route for team_invitation.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getAcceptFormRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('accept-form')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('accept-form'));
$route
->setDefault('_entity_form', "{$entity_type_id}.accept");
$route
->setDefault('_title_callback', TeamInvitationTitleProvider::class . '::acceptTitle');
$route
->setDefault('entity_type_id', $entity_type_id);
$this
->ensureTeamParameter($route);
$route
->setRequirement('_entity_access', "{$entity_type_id}.accept");
return $route;
}
}
/**
* Gets the decline-form route for team_invitation.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getDeclineFormRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('decline-form')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('decline-form'));
$route
->setDefault('_entity_form', "{$entity_type_id}.decline");
$route
->setDefault('_title_callback', TeamInvitationTitleProvider::class . '::declineTitle');
$route
->setDefault('entity_type_id', $entity_type_id);
$this
->ensureTeamParameter($route);
$route
->setRequirement('_entity_access', "{$entity_type_id}.decline");
return $route;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultHtmlRouteProvider:: |
protected | property | The entity field manager. | |
DefaultHtmlRouteProvider:: |
protected | property | The entity type manager. | |
DefaultHtmlRouteProvider:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
1 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the add-form route. | 2 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the add page route. | 2 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the canonical route. | 3 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the collection route. | 2 |
DefaultHtmlRouteProvider:: |
protected | function | Returns the delete multiple form route. | 1 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the edit-form route. | 1 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the type of the ID key for a given entity type. | 1 |
DefaultHtmlRouteProvider:: |
public | function | Constructs a new DefaultHtmlRouteProvider. | 1 |
TeamInvitationRouteProvider:: |
protected | function | Gets the accept-form route for team_invitation. | |
TeamInvitationRouteProvider:: |
protected | function | Gets the decline-form route for team_invitation. | |
TeamInvitationRouteProvider:: |
protected | function |
Gets the delete-form route for team_invitation. Overrides DefaultHtmlRouteProvider:: |
|
TeamInvitationRouteProvider:: |
protected | function | Gets the notify-form route for team_invitation. | |
TeamInvitationRouteProvider:: |
public | function |
Provides routes for entities. Overrides DefaultHtmlRouteProvider:: |
|
TeamRoutingHelperTrait:: |
private | function | If route contains the {team} parameter add required changes to the route. |