Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Menu Trail by Path - ERROR #438

Open
OPCIT opened this issue Mar 31, 2020 · 11 comments
Open

Menu Trail by Path - ERROR #438

OPCIT opened this issue Mar 31, 2020 · 11 comments

Comments

@OPCIT
Copy link

OPCIT commented Mar 31, 2020

On local Dev enable this module and got the following error which has killed the site. Will need to use drush to disable the module. Enabling a module in the disto should never kill a site.

The website encountered an unexpected error. Please try again later.
TypeError: Argument 5 passed to Drupal\menu_trail_by_path\MenuTrailByPathActiveTrail::__construct() must implement interface Drupal\menu_trail_by_path\Path\PathHelperInterface, instance of Drupal\context\ContextManager given, called in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 301 in Drupal\menu_trail_by_path\MenuTrailByPathActiveTrail->__construct() (line 51 of modules/contrib/menu_trail_by_path/src/MenuTrailByPathActiveTrail.php).

@OPCIT
Copy link
Author

OPCIT commented Mar 31, 2020

ahoy drush pm-uninstall menu_trail_by_path

@simesy
Copy link
Contributor

simesy commented Apr 1, 2020

Can you check if you have context module installed, as I think this is a known conflict.

@OPCIT
Copy link
Author

OPCIT commented Apr 1, 2020

Hey Si, we certainly do have it enabled.

Whilst I found a work around to fix the lack of 'active-trail' of book navigation, it will obviously be good to get this resolved at some point by the module maintainers.

Thanks!

@simesy
Copy link
Contributor

simesy commented Apr 1, 2020

Ok yeah, upstream incompatibility. Ideally the distro would warn or prevent installing both.

This upstream ticket for the record. In theory if you have menu_trail_by_path installed then you don't want the Context functionality related to menu_trails, so context module gets out of the way. https://www.drupal.org/project/context/issues/3018331

@simesy
Copy link
Contributor

simesy commented Apr 1, 2020

I usually do my own breadcrumbs in the theme layer. The saas tools are generally lacking.

@OPCIT
Copy link
Author

OPCIT commented Apr 1, 2020

I wanted this module to see if it would help with book navigation output. The default template does not add any <ul> or <li> classes to help identify the active trail.

Was able to add 'book-tree.html.twig' to the theme and customise accordingly:

{% macro book_links(items, attributes, menu_level) %}
{% import _self as book_tree %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes }} class="book-list">
{% else %}


    {% endif %}
    {% for item in items %}
    {% if item.in_active_trail == TRUE %}
    <li{{ item.attributes }} class="book-list-item active-trail">
    {% else %}
    <li{{ item.attributes }} class="book-list-item">
    {% endif %}
    {{ link(item.title, item.url) }}
    {% if item.below %}
    {{ book_tree.book_links(item.below, attributes, menu_level + 1) }}
    {% endif %}

    {% endfor %}

{% endif %}
{% endmacro %}

@Belhendo
Copy link

Belhendo commented Apr 7, 2020

Hi @OPCIT and @simesy

Thanks for the heads up, we'll investigate the conflict in the distribution and will let you know if there's a patch.

@OPCIT
Copy link
Author

OPCIT commented May 25, 2020

@Belhendo @simesy

A patch for this was released some time ago.

https://www.drupal.org/project/context/issues/3018331

I've updated a local GovCMS 8 code base and found it to work as advertised.

I can now install both modules without error.

@Belhendo
Copy link

Thanks for this info. We will need to wait until the patch is rolled into the next stable version of the Menu Trail by Patch module so we keep stable releases in the distribution without patches.

@TobyWild
Copy link
Contributor

@Belhendo - The patch was created six months ago, and the last release of Context (that this patch is for) was released 3 years ago... so maybe "wait for release" isn't the best idea when the simple act of enabling a module can white screen and entire site.

@OPCIT
Copy link
Author

OPCIT commented May 28, 2020

@Belhendo @tobybellwood @simesy

What is GovCMS's proposed action for when a module maintainer is not actively monitoring or updating a module that is part of the GovCMS distro?

The Context module has a number of maintainers listed, but all bar one seems to have not touched it for quite some time. I've tried to contact the one maintainer that seems to still be around, but I'm not sure if he received my message (need to wait and see).

The 'Menu Trail By Path' is a very useful module so it is a shame that another module that is equally very useful isn't being maintained properly and as such causes a WSD.

Is it possible that GovCMS can fork either module as part of the distribution so that both module work in parallel?

What I'm getting at is how can issues like this be avoided when modules in the distro are not properly maintained?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants