class CiviCrmEntityRouteProvider in CiviCRM Entity 8.3
Provides routing for CiviCRM entities.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
- class \Drupal\civicrm_entity\Routing\CiviCrmEntityRouteProvider
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
Expanded class hierarchy of CiviCrmEntityRouteProvider
1 file declares its use of CiviCrmEntityRouteProvider
- civicrm_entity.module in ./
civicrm_entity.module - Module file for the CiviCRM Entity module.
File
- src/
Routing/ CiviCrmEntityRouteProvider.php, line 12
Namespace
Drupal\civicrm_entity\RoutingView source
class CiviCrmEntityRouteProvider extends AdminHtmlRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
if ($entity_type
->get('civicrm_entity_ui_exposed')) {
return parent::getRoutes($entity_type);
}
return new RouteCollection();
}
/**
* {@inheritdoc}
*/
protected function getAddFormRoute(EntityTypeInterface $entity_type) {
$has_bundles = $entity_type
->hasKey('bundle');
$entity_add_form_route = parent::getAddFormRoute($entity_type);
if ($has_bundles) {
// This ensures the form receives a default bundle from the
// CivicrmEntity::preCreate method, avoiding the need for the `add_page`
// route for selecting a bundle.
assert($entity_add_form_route !== NULL);
$entity_add_form_route
->setDefault('bundle', $entity_type
->id());
}
return $entity_add_form_route;
}
}