protected function alterRoutes(RouteCollection $collection) {
if($route = $collection->get('entity.node.edit_form')) {
$route->setDefault('_entity_form', '\Drupal\alerts\Form\EditAdvisoryForm');
}
}
Causes a permission error. The logs say
Path: /node/1277957/edit?destination=/admin/content. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 117 of /app/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).
It doesn't seem to prefill the form with the editable info. This is also not content type specific.
Please advise. Other posts close to this do not have an answer.
_entity_form
. See drupal.stackexchange.com/questions/283113/…. You can also replace the existing form handler in the entity type if you want to change the node edit form for the entire site without altering routes.