Commit f22d84fc authored by chr.fritsch's avatar chr.fritsch Committed by TravisCarden

Issue #2904660 by chr.fritsch, TravisCarden: Url objects in...

Issue #2904660 by chr.fritsch, TravisCarden: Url objects in hook_checklistapi_checklist_info() cause RuntimeException: Recursive router rebuild detected
parent f701acd9
......@@ -124,6 +124,10 @@ function callback_checklistapi_checklist_items() {
* definitions are passed in by reference. Additional checklists may be added,
* or existing checklists may be altered or removed.
*
* Note: Checklist paths (#path) cannot be altered. See
* https://www.drupal.org/docs/8/api/routing-system/altering-existing-routes-and-adding-new-routes-based-on-dynamic-ones
* instead.
*
* @param array $definitions
* The multidimensional array of checklist definitions returned by
* hook_checklistapi_checklist_info().
......
......@@ -53,7 +53,6 @@ function checklistapi_checklist_access($id, $operation = 'any') {
*/
function checklistapi_checklist_load($id) {
$definition = checklistapi_get_checklist_info($id);
$definition = checklistapi_add_checklist_items($definition);
return ($definition) ? new ChecklistapiChecklist($definition) : FALSE;
}
......
......@@ -248,7 +248,6 @@ class ChecklistapiChecklist {
// Loop through items.
foreach ($group as $item_key => $item) {
$definition = checklistapi_get_checklist_info($this->id);
$definition = checklistapi_add_checklist_items($definition);
if (!in_array($item_key, array_keys($definition[$group_key]))) {
// This item wasn't in the checklist definition. Don't include it with
// saved progress.
......
......@@ -17,7 +17,8 @@ class ChecklistapiRoutes {
*/
public function routes() {
$routes = [];
foreach (checklistapi_get_checklist_info() as $id => $definition) {
$definitions = \Drupal::moduleHandler()->invokeAll('checklistapi_checklist_info');
foreach ($definitions as $id => $definition) {
// Ignore incomplete definitions.
if (empty($definition['#path']) || empty($definition['#title'])) {
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment