Closed Polynya closed 4 months ago
The module currently expects all items in the subsites menu to be nodes but there may be other links such as Views pages. Also, the menu may be wanted on pages that are not in the menu.
This PR adds an alter hook so other modules can set the home page. An event may be better way, https://github.com/localgovdrupal/localgov_subsites_extras/pull/14
Example usage
/** * Implements hook_localgov_subsites_extras_homepage_alter(). */ function example_localgov_subsites_extras_homepage_alter(?NodeInterface &$homepage) { if (!$homepage) { $url = \Drupal::request()->getRequestUri(); if (str_starts_with($url, '/mysubsite')) { $homepage = \Drupal::entityTypeManager()->getStorage('node')->load(999); } } }
I think this can be closed as it's very similar to https://github.com/localgovdrupal/localgov_subsites_extras/issues/2
Let's close this in favour of #2, which has a PR attached to it a well.
The module currently expects all items in the subsites menu to be nodes but there may be other links such as Views pages. Also, the menu may be wanted on pages that are not in the menu.
This PR adds an alter hook so other modules can set the home page. An event may be better way, https://github.com/localgovdrupal/localgov_subsites_extras/pull/14
Example usage