You are here

class CouponRouteProvider in Commerce Core 8.2

Provides routes for the Coupon entity.

Hierarchy

Expanded class hierarchy of CouponRouteProvider

File

modules/promotion/src/CouponRouteProvider.php, line 11

Namespace

Drupal\commerce_promotion
View source
class CouponRouteProvider extends AdminHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  protected function getAddFormRoute(EntityTypeInterface $entity_type) {
    $route = parent::getAddFormRoute($entity_type);
    $route
      ->setOption('parameters', [
      'commerce_promotion' => [
        'type' => 'entity:commerce_promotion',
      ],
    ]);

    // Coupons can be created if the parent promotion can be updated.
    $requirements = $route
      ->getRequirements();
    unset($requirements['_entity_create_access']);
    $requirements['_entity_access'] = 'commerce_promotion.update';
    $route
      ->setRequirements($requirements);
    return $route;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdminHtmlRouteProvider::getAddPageRoute protected function Gets the add page route. Overrides DefaultHtmlRouteProvider::getAddPageRoute
AdminHtmlRouteProvider::getDeleteFormRoute protected function Gets the delete-form route. Overrides DefaultHtmlRouteProvider::getDeleteFormRoute
AdminHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. Overrides DefaultHtmlRouteProvider::getDeleteMultipleFormRoute
AdminHtmlRouteProvider::getEditFormRoute protected function Gets the edit-form route. Overrides DefaultHtmlRouteProvider::getEditFormRoute 1
CouponRouteProvider::getAddFormRoute protected function Gets the add-form route. Overrides AdminHtmlRouteProvider::getAddFormRoute
DefaultHtmlRouteProvider::$entityFieldManager protected property The entity field manager.
DefaultHtmlRouteProvider::$entityTypeManager protected property The entity type manager.
DefaultHtmlRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance 1
DefaultHtmlRouteProvider::getCanonicalRoute protected function Gets the canonical route. 3
DefaultHtmlRouteProvider::getCollectionRoute protected function Gets the collection route. 2
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::getRoutes public function Provides routes for entities. Overrides EntityRouteProviderInterface::getRoutes 1
DefaultHtmlRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. 1