public function EntityController::getEntity in Convert Bundles 8
Retrieves entity from route match.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.
Return value
\Drupal\Core\Entity\EntityInterface|null The entity object as determined from the passed-in route match.
File
- src/
Controller/ EntityController.php, line 77
Class
- EntityController
- Controller for convert bundles entity.
Namespace
Drupal\convert_bundles\ControllerCode
public function getEntity(RouteMatchInterface $route_match) {
$parameter_name = $route_match
->getRouteObject()
->getOption('_convert_bundles_entity_type_id');
$entity = $route_match
->getParameter($parameter_name);
$ids[$entity
->id()] = $entity;
$this->tempStoreFactory
->get('convert_bundles_ids')
->set($this->currentUser, $ids);
return $this
->redirect('convert_bundles.form', [], [
'query' => [
'destination' => '/' . $entity
->getEntityTypeId() . '/' . $entity
->id(),
],
]);
}