CouponRouteProvider.php in Commerce Core 8.2
File
modules/promotion/src/CouponRouteProvider.php
View source
<?php
namespace Drupal\commerce_promotion;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
class CouponRouteProvider extends AdminHtmlRouteProvider {
protected function getAddFormRoute(EntityTypeInterface $entity_type) {
$route = parent::getAddFormRoute($entity_type);
$route
->setOption('parameters', [
'commerce_promotion' => [
'type' => 'entity:commerce_promotion',
],
]);
$requirements = $route
->getRequirements();
unset($requirements['_entity_create_access']);
$requirements['_entity_access'] = 'commerce_promotion.update';
$route
->setRequirements($requirements);
return $route;
}
}