The route "view.simplenews_newsletters.page_1" is configured as part of a menu. This means that the site becomes unusable if for any reason that view is not present, which can occur:

We need to somehow guard against this case.

Comments

AdamPS created an issue. See original summary.

berdir’s picture

The problem is that you can't have hardcoded menu links/local tasks/actions that depending configuration. needs to be moved to a alter hook to check if the view exists. Or the opposite, remove it if it doesn't.

adamps’s picture

The right place to define a menu is directly on the view. However the view already has a menu tab and we can't define both on the view.

I did some testing (see code below) and it seems that hook_menu_links_discovered_alter() doesn't get called when a view is enabled/disabled. Probably it can be done with a deriver class but I'm out of time for now.

function simplenews_menu_links_discovered_alter(&$links) {
  if (!count(\Drupal::service('router.route_provider')->getRoutesByNames(['view.simplenews_newsletters.page_1']))) {
    unset($links['simplenews.newsletters']);
  }
}

mohit.bansal623’s picture

Status: Active » Needs review
StatusFileSize
new482 bytes

I have removed that menu.yml code as that route does not exists anywhere. After that it works fine.

adamps’s picture

Status: Needs review » Needs work
Issue tags: +Plan to commit

The route comes from the view views.view.simplenews_newsletters.yml.

However I think I am in favour of the simple option of just removing the link. It's not a huge loss and the current bug is major. If we solve #3053111: Issue status should not be stored on issue entity then we can most likely put the link back with a route entity.simplenews_issue_status.collection. I will add a @todo comment then commit.

mohit.bansal623’s picture

Status: Needs work » Needs review

@AdamPS, please review. If we have separate issue for the same, we can close this ticket.

adamps’s picture

Status: Needs review » Needs work

I suggest that the work required is:

Thanks

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new768 bytes

Status: Needs review » Needs work

The last submitted patch, 8: simplenews.broken-route.3190384-8.patch, failed testing. View results

  • AdamPS committed 091f1bb on 3.x
    Issue #3190384 by AdamPS, mohit.bansal623: Route "view....
adamps’s picture

Status: Needs work » Fixed
Issue tags: -Plan to commit

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.