New answers tagged

0

The accepted answer may be appropriate for the intended use case of the OP, however, the title of this question is "Routing match everything". As this is the closest question I've found from searching the interwebs, I'll just share my discovery here on how to accomplish this for SPAs where all paths that start with "/app" need to be redirected to a single ...


0

I found the solution myself. I just created a new route with the requirement _format: json and the path /node/{node} just like entity.node.canonical. Then I could set a controller that is only called when the node is being output in JSON format. My route definition looks like this: entity.node.canonical.json: path: '/node/{node}' defaults: ...


1

Wound up figuring this out I suppose, although I have no idea if this is the proper way. Under the custom module I wanted to test, I created a 'tests' directory with a test module and within that new module placed 3 configuration files from my project config ("Show Profile" field storage, "Show Profile" field instance, user form display configuration). In ...


2

Turns out I just had to chain it to the AccessResult like so: AccessResult::allowed()->addCacheableDependency($requested_profile); Same for forbidden(). Now the 'View' tab is visible appropriately.


0

For Drupal 8: you can use hook_menu_local_tasks_alter /** * Hide view tab from node edit. */ function MYMODULE_menu_local_tasks_alter(&$data, $route_name, \Drupal\Core\Cache\RefinableCacheableDependencyInterface &$cacheability) { if($route_name == 'entity.node.edit_form'){ unset($data['tabs'][0]['entity.node.canonical']); } }


1

Add a route enhancer: Example how _form gets replaced by _controller: Drupal\Core\Routing\Enhancer\FormRouteEnhancer: <?php namespace Drupal\Core\Routing\Enhancer; use Drupal\Core\Routing\EnhancerInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; /** *...


0

the included routing files in a single file reouting.yml does not work under drupal because in drupal there is not the notion of bundle I tested by passing the module name and also the namespace but it does not work myroute_form: resource: "@module_name/routing/salesforce_front_routing.yml" myroute_form2: resource: "@Drupal/module_name/routing/...


Top 50 recent answers are included