public function FlagAddForm::getEntityFromRouteMatch in Flag 8.4
Determines which entity will be used by this form from a RouteMatch object.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.
string $entity_type_id: The entity type identifier.
Return value
\Drupal\Core\Entity\EntityInterface The entity object as determined from the passed-in route match.
Overrides EntityForm::getEntityFromRouteMatch
File
- src/
Form/ FlagAddForm.php, line 35
Class
- FlagAddForm
- Provides the flag add form.
Namespace
Drupal\flag\FormCode
public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {
$flag = parent::getEntityFromRouteMatch($route_match, $entity_type_id);
// Set the flag type from the route parameter. This is set by the redirect
// in FlagAddPageForm::submitForm().
$type = $route_match
->getRawParameter('entity_type');
$flag
->setFlagTypePlugin($type);
return $flag;
}