public function WebformEntityReferenceManager::isUserWebformRoute in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformEntityReferenceManager.php \Drupal\webform\WebformEntityReferenceManager::isUserWebformRoute()
Is the current request a webform route where the user can specify a webform.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: A fieldable content entity.
Return value
bool TRUE if the current request a webform route where the user can specify a webform.
Overrides WebformEntityReferenceManagerInterface::isUserWebformRoute
File
- src/WebformEntityReferenceManager.php, line 105 
Class
- WebformEntityReferenceManager
- Webform entity reference (field) manager.
Namespace
Drupal\webformCode
public function isUserWebformRoute(EntityInterface $entity) {
  $entity_type = $entity
    ->getEntityTypeId();
  $route_name = $this->routeMatch
    ->getRouteName();
  $user_routes = [
    "entity.{$entity_type}.webform.test_form",
    "entity.{$entity_type}.webform.api_form",
  ];
  return in_array($this->routeMatch
    ->getRouteName(), $user_routes) || strpos($route_name, "entity.{$entity_type}.webform.results_") === 0 || strpos($route_name, "entity.{$entity_type}.webform.share_") === 0;
}