Skip to content

Commit

Permalink
Allow option to disable routing
Browse files Browse the repository at this point in the history
Since this conflicts with Bolt Translate
  • Loading branch information
xiaohutai committed Jan 4, 2019
1 parent 96f1b68 commit 5463765
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/config.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ rules:
#
# override-slugs: Allow (slugifized) names in `menu.yml` override the slugs
# defined in the records.
# enable-routing: If you want to make use of hierarchies, but not the routing.
# When using Bolt Translate, the Bolt Translate routing should
# take over, so set this to `false`. Bolt Translate integration
# is not working.
#

settings:
overwrite-duplicates : true
override-slugs : false
enable-routing : true
7 changes: 5 additions & 2 deletions src/Routing/HierarchicalUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ public function __construct(UrlGeneratorInterface $wrapped, Application $app)
*/
public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
if ($name == 'contentlink') {
$service = $this->app['hierarchicalroutes.service'];
$config = $this->app['hierarchicalroutes.config'];
$enableRouting = $config->get('settings/enable-routing', true);

if ($enableRouting && $name == 'contentlink') {
$service = $this->app['hierarchicalroutes.service'];

/**
* Since Bolt 3.3. Bolt now strips away all the parameters that are not needed for the
Expand Down

0 comments on commit 5463765

Please sign in to comment.