class SubscriptionRouteProvider in Commerce Recurring Framework 8
Provides routes for the Subscription entity.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\entity\Routing\DefaultHtmlRouteProvider
- class \Drupal\commerce_recurring\SubscriptionRouteProvider
- class \Drupal\entity\Routing\DefaultHtmlRouteProvider
Expanded class hierarchy of SubscriptionRouteProvider
File
- src/
SubscriptionRouteProvider.php, line 12
Namespace
Drupal\commerce_recurringView source
class SubscriptionRouteProvider extends DefaultHtmlRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
if ($cancel_form_route = $this
->getCancelFormRoute($entity_type)) {
$collection
->add('entity.commerce_subscription.cancel_form', $cancel_form_route);
}
if ($customer_view_route = $this
->getCustomerViewRoute($entity_type)) {
$collection
->add('entity.commerce_subscription.customer_view', $customer_view_route);
}
if ($customer_edit_form_route = $this
->getCustomerEditFormRoute($entity_type)) {
$collection
->add('entity.commerce_subscription.customer_edit_form', $customer_edit_form_route);
}
return $collection;
}
/**
* Gets the cancel-form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route
* The generated route.
*/
protected function getCancelFormRoute(EntityTypeInterface $entity_type) {
$route = new Route($entity_type
->getLinkTemplate('cancel-form'));
$route
->addDefaults([
'_entity_form' => 'commerce_subscription.cancel',
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title',
])
->setRequirement('_entity_access', 'commerce_subscription.cancel')
->setRequirement('commerce_subscription', '\\d+')
->setOption('parameters', [
'commerce_subscription' => [
'type' => 'entity:commerce_subscription',
],
]);
return $route;
}
/**
* Gets the customer-edit-form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route
* The generated route.
*/
protected function getCustomerEditFormRoute(EntityTypeInterface $entity_type) {
$route = new Route($entity_type
->getLinkTemplate('customer-edit-form'));
$route
->addDefaults([
'_entity_form' => 'commerce_subscription.customer',
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title',
])
->setRequirement('_entity_access', 'commerce_subscription.update')
->setRequirement('commerce_subscription', '\\d+')
->setOption('parameters', [
'user' => [
'type' => 'entity:user',
],
'commerce_subscription' => [
'type' => 'entity:commerce_subscription',
],
]);
return $route;
}
/**
* Gets the customer-view route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route
* The generated route.
*/
protected function getCustomerViewRoute(EntityTypeInterface $entity_type) {
$route = new Route($entity_type
->getLinkTemplate('customer-view'));
$route
->addDefaults([
'_entity_view' => 'commerce_subscription.customer',
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title',
])
->setRequirement('_entity_access', 'commerce_subscription.view')
->setRequirement('commerce_subscription', '\\d+')
->setOption('parameters', [
'user' => [
'type' => 'entity:user',
],
'commerce_subscription' => [
'type' => 'entity:commerce_subscription',
],
]);
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. Overrides DefaultHtmlRouteProvider:: |
|
DefaultHtmlRouteProvider:: |
protected | function | Gets the delete-form route. | 1 |
DefaultHtmlRouteProvider:: |
protected | function | Returns the delete multiple form route. | 1 |
DefaultHtmlRouteProvider:: |
protected | function | Gets the duplicate-form route. | |
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 |
SubscriptionRouteProvider:: |
protected | function | Gets the cancel-form route. | |
SubscriptionRouteProvider:: |
protected | function | Gets the customer-edit-form route. | |
SubscriptionRouteProvider:: |
protected | function | Gets the customer-view route. | |
SubscriptionRouteProvider:: |
public | function |
Provides routes for entities. Overrides DefaultHtmlRouteProvider:: |