Hot answers tagged

5

Instead of \Drupal::service('router.builder')->rebuild() you can invalidate route matches: Cache::invalidateTags(['route_match']); You don't need to rebuild the router table, because the static routes don't change. What you need to clear are route matches, which are calculated on the processed path and then stored for the unprocessed path. And this is ...


1

Use more placeholders in your route, like path: 'booking/{url_alias}/{anyother}' Then add a default for the last one, like defaults: anyother: "" Now your Path applies for two and three uri components. Check this page for default parameters in form - routes: https://www.drupal.org/docs/8/api/routing-system/parameters-in-routes/using-parameters-in-...


1

Is this possible? path: 'booking/{url_alias}' or path: '{url_alias}/booking' path: '{url_alias}/booking' paths can never start with a slug/placeholder. You'll have to use path: 'booking/{url_alias}' In your form: /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $url_alias = NULL) { // Some DB ...


Only top voted, non community-wiki answers of a minimum length are eligible