Giter Club home page Giter Club logo

navigation's Introduction

Navigation icon

Navigation for Craft CMS

Navigation is a Craft CMS plugin to help manage navigation menus for you site. Supports linking to existing elements like entries, categories and products, as well as custom URLs.

Features

  • Create multiple navigations
  • Create navigation nodes for entries, assets, categories and Commerce products
  • Create custom URLs
  • Enable/disable, open links in a new window, or apply additional CSS classes
  • Automatically updates nodes when linked elements status or title changes
  • Navigation nodes are elements for flexible querying
  • Support for third-party elements with hooks
  • Support for multi-site navigations
  • Simple render() Twig function, or roll your own
  • Generate breadcrumbs easily based on your URL segments
  • Tool to migrate your menus if you've used A&M Nav for Craft 2 or Navee for Craft 2

Documentation

Visit the Navigation Plugin page for all documentation, guides, pricing and developer resources.

Credit & Thanks

A big shoutout to A&M Nav for their awesome plugin for Craft 2.

Support

Get in touch with us via the Navigation Support page or by creating a Github issue

navigation's People

Contributors

alexthn avatar billythekid avatar boboldehampsink avatar chasegiunta avatar engram-design avatar gtettelaar avatar iainsaxon avatar juddlyon avatar lewisjenkins avatar pascalminator avatar qbasic16 avatar saboteur777 avatar steverowling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

navigation's Issues

Deprecation warning

Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them. On xxx/verbb/navigation/src/elements/Node.php:122
view screenshot

FR: Ability to choose a different element once node saved

This may already be on the radar.

As it stands we can't change the element chosen for a nav item once it's been set without deleting and adding the node as a new node. This is particularly annoying when it's a top level node with children.

The workaround for this is to save all nodes as custom/manual and manually change the URL should the element URL change. Not ideal.

This is to request that 'Choose Entry' etc be an available option in the node settings. (probably around where the link to the entry's cpEditUrl is)

Element nodes are saving URLs

Description

Firstly, thanks so much for this plugin. Every bit as good as the old AMNav one and nice work on giving them a credit.

The issue - When saving element nodes absolute URLs are being stored instead of NULL. This results in the URL output being an absolute/saved URL instead of getting the current element's URL. (Which can cause issues for example when moving between dev/staging on a shared DB) A cursory glance at the code it looks like if a node is an element that the url field should be NULL?

Steps to reproduce

  1. Select an entry as the navigation node and save
  2. Check the output or database - the URL is saved - including the siteUrl part for whatever environment you are working in.

Additional info

Manually changing the element urls in the database table to NULL properly gives the element URL on the front end so output does seem to work properly, it's the saving part that appears to not work quite right.

  • Plugin version: 1.0.0
  • Craft version: 3.0.15

Node type is unstyled during dragging

During dragging, except node name we also see node type below it - its unstyled thought.

I propose one of two solutions - either make node type still styled while dragging, or just hide it while dragging.

Plugin throwing error when entries are updated by the console

Description

I use the Schematic plugin to update Sections using the console. When I try to do this now, an exception is thrown due to Navigation's verbb\navigation\services\Nodes::onSaveElement() method. It appears that the problem is due to the fact that Request::getSegments() method is called in order to determine whether a URL is active, but this method does not exist for console requests.

Here is the full stacktrace (Navigation's involvement starts on line #8):

Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: craft\console\Request::getSegments()' in /var/www/vendor/yiisoft/yii2/base/Component.php:300
Stack trace:
#0 /var/www/vendor/verbb/navigation/src/elements/Node.php(123): yii\base\Component->__call('getSegments', Array)
#1 /var/www/vendor/yiisoft/yii2/base/Component.php(139): verbb\navigation\elements\Node->getActive()
#2 /var/www/vendor/craftcms/cms/src/base/Element.php(796): yii\base\Component->__get('active')
#3 /var/www/vendor/verbb/navigation/src/elements/db/NodeQuery.php(92): craft\base\Element->__get('active')
#4 /var/www/vendor/yiisoft/yii2/db/Query.php(238): verbb\navigation\elements\db\NodeQuery->populate(Array)
#5 /var/www/vendor/craftcms/cms/src/db/Query.php(161): yii\db\Query->all(NULL)
#6 /var/www/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1172): craft\db\Query->all(NULL)
#7 /var/www/vendor/verbb/navigation/src/services/Nodes.php(55): craft\elements\db\ElementQuery->all()
#8 [internal function]: verbb\navigation\services\Nodes->onSaveElement(Object(craft\events\ElementEvent))

#9 /var/www/vendor/yiisoft/yii2/base/Event.php(310): call_user_func(Array, Object(craft\events\ElementEvent))
#10 /var/www/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\\services\\...', 'beforeSaveEleme...', Object(craft\events\ElementEvent))
#11 /var/www/vendor/craftcms/cms/src/services/Elements.php(382): yii\base\Component->trigger('beforeSaveEleme...', Object(craft\events\ElementEvent))
#12 /var/www/vendor/craftcms/cms/src/services/Sections.php(1290): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#13 /var/www/vendor/craftcms/cms/src/services/Sections.php(635): craft\services\Sections->_onSaveSingle(Object(craft\models\Section), false, Array)
#14 /var/www/vendor/nerds-and-company/schematic/src/Converters/Models/Section.php(47): craft\services\Sections->saveSection(Object(craft\models\Section))
#15 /var/www/vendor/nerds-and-company/schematic/src/Mappers/ModelMapper.php(68): NerdsAndCompany\Schematic\Converters\Models\Section->saveRecord(Object(craft\models\Section), Array)
#16 /var/www/vendor/nerds-and-company/schematic/src/Controllers/ImportController.php(88): NerdsAndCompany\Schematic\Mappers\ModelMapper->import(Array, Array)
#17 /var/www/vendor/nerds-and-company/schematic/src/Controllers/ImportController.php(49): NerdsAndCompany\Schematic\Controllers\ImportController->importFromYaml(Array)
#18 [internal function]: NerdsAndCompany\Schematic\Controllers\ImportController->actionIndex()
#19 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#20 /var/www/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#21 /var/www/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array)
#22 /var/www/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array)
#23 /var/www/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('schematic/impor...', Array)
#24 /var/www/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('schematic/impor...', Array)
#25 /var/www/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#26 /var/www/craft(22): yii\base\Application->run()
#27 {main}

This error seems to have been introduced somewhere between versions 1.0.13-1.0.15. I'm aware that the Schematic plugin is part of this issue, but it seems that the problem is due to Navigation not taking into consideration cases where elements are updated through the console, so this doesn't seem to be a problem only when using the Schematic plugin.

Just to be clear, this error happens when trying to update a Single section through the console.

Steps to reproduce

  1. Export sections schema using Schematic
  2. Import sections schema
  3. See exception thrown

Additional info

  • Plugin version: 1.0.15 (maybe since 1.0.13?)
  • Craft version: 3.0.31

Disabling menu item for one site in a multisite

This might not be a common kind of need, but I also think it might be :-)

I have a simple multiple language site where some entries in one of the languages need to be disabled in the menu, but still may be needed at a later time. This is also something that could come up quite often if people are using the option to propagate menu items across all sites and some pages are not yet live, or will not be needed in one site.

I realise that we could delete that navigation entry from the menu for one of the sites and add it in again when it needs to go live, but that just opens up more chances for human error, and we would also like the disabled state to be a visual reminder that we will eventually need to get that page enabled again in that language.

Do you think there might be any value in adding a setting to Navigation that replicates the default Craft enabled states? That is, a system-wide enabled option for the entry, with separate site-specific options as well. It would add a lot of value to the plugin and (to me, at least) make it work in a more intuitive way.

Anyway, thanks for listening ...

Steps to reproduce

  1. Add the same entry to all languages in a multisite project
  2. Disable the navigation item in one language
  3. Check the other language, where the same entry will also be disabled

Additional info

  • Plugin version: 1.0.9
  • Craft version: Craft Pro 3.0.24

Set navigation to recently chosen site / locale

Description

When you have been filling in a certain site/locale through through the Entries or Globals the most recent site / locale that you've edited gets loaded each time, but when you try to modify a navigation, the nav that gets loaded is for the first site (not the previously chosen one).

See this screencapture to make it more clear => Link

Steps to reproduce

  1. Create multiple sites (A, B)
  2. Edit an entry for site B
  3. Go to Navigation and edit one > Navigation for site A gets loaded while we we're previously editing entries for site B

Additional info

  • Plugin version: latest
  • Craft version: latest

Multisite: only navigation from primary site shown

If you have multiple sites, and you have a user that can only edit one site (that is not the primary site), the navigation from the primary site is shown instead of the navigation from the site the user can edit.

So:
John can edit sitaA (primary) and siteB
John adds navigation for siteA and site B
Eric can only edit siteB
When Eric clicks on the navigation plugin, the navigation from siteA is shown

Allowing getActiveNode() to be filtered by .handle('navTitle')

Description

On our site we are using the navigation plugin for both the main navigation and the footer navigation. On top level pages (i.e. resources index) we are using the navigation plugin to populate a sub nav in a banner. We are successful in rendering the sub-nav when the active node is not in both the footer navigation and the main navigation. If the current active node is indeed in both navigations (i.e. resources index) we are unable to filter by the navigation handle resulting in the sub nav not appearing.

We are looking for the ability to get the active node and if it is within the selected navigation handle then populate it, otherwise dont.

Steps to reproduce

  1. getting the active node:
    {% set activeNode = craft.navigation.getActiveNode() %}
  2. getting the sub nav within a particluar handle that is a descendant of the active node
    {% set subNavigationNodes = craft.navigation.nodes().handle('mainNavigation').descendantOf(activeNode) %}

What we would love to see

Here's a snippet of what we think might be a good way to approach this, similar to how child nodes are rendered off of a specific navigation handle:
craft.navigation.handle('navigationHandle').getActiveNode()

Additional info

  • Plugin version: 1.0.18
  • Craft version: 3.0.34

Twig Runtime Error – Key "activeClass" does not exist as the array is empty.

If I use just the render tag with no arguments, I get the following error whenever I visit a page that's included in the navigation:

Twig_Error_Runtime: Key "activeClass" does not exist as the array is empty. in /app/vendor/verbb/navigation/src/templates/_special/render.html:6
<a href="{{ node.url }}" class="{% if node.active %}{{ options.activeClass ?: 'active' }}{% endif %}{% if options.aClass is defined %} {{ options.aClass }}{% endif %}"{% if node.newWindow %}

If I add an activeClass value to the render tag, the page loads correctly. I tried uninstalling and re-installing the plugin with no luck.

Additional info

  • Plugin version: 1.09
  • Craft version: 3.0.21

BUG: Exception when navigating to the homepage

Description

Navigating to the homepage throws an exception Trying to get property 'uri' of non-object

Changing line 128 of \vendor\verbb\navigation\src\elements\Node.php
from
if ($this->_elementUrl && $this->_elementUrl->uri === '__home__') {
to
if ($this->_elementUrl && $this->_elementUrl === '__home__') {

Fixes the issue. Page then loads and homepage nav item is set to active

Steps to reproduce

  1. Updated to version 1.0.13.
  2. Navigating to the home page throws the exception

Additional info

  • Plugin version: 1.0.13
  • Craft version: 3.0.30.2

Setting a Parent Node Active When a Descendant is Active

Description

When creating the entire UI of the menu manually the primary node doesn't return active if their is a descendant of the parent which is active. Is there a way to achieve this without necessarily looping through all of the descendant nodes to set the class?

I'm working on a previous project that uses Bootstrap 4. Using the following, I get everything working pretty well.

{% set nodes = craft.navigation.nodes().handle('primaryMenu').level(1).all() %}

<nav class="navbar navbar-expand-lg navbar-light bg-light my-2">
  <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavDropdown">
    <ul class="navbar-nav">
      {% for node in nodes %}
        {% if node.hasDescendants %}
          <li class="nav-item dropdown {% if node.active %}active{% endif %}">
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown{{ node.id }}" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              {{ node.title }}
            </a>
            <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              {% for subnode in node.children.all() %}
                <a class="dropdown-item {% if subnode.active %}active{% endif %}" href="{{ subnode.url }}">{{ subnode.title }}</a>
              {% endfor %}
            </div>
          </li>
        {% else %}
          <li class="nav-item {% if node.active %}active{% endif %}">
            <a class="nav-link" href="{{ node.url }}">{{ node.title }} {% if node.active %}<span class="sr-only">(current)</span>{% endif %}</a>
          </li>
        {% endif %}
      {% endfor %}
    </ul>
  </div>
</nav>

For the line:

<li class="nav-item dropdown {% if node.active %}active{% endif %}">

Is there a way to do something like {% if node.active or node.children.active %}active{% endif %}?

Technically, I could do:

{% for node in nodes %}
  {% if node.hasDescendants %}
    {% set activeChildren = false %}
    {% for subnode in node.children.all() %}
      {% if subnode.active %}
        {% set activeChildren = true %}
      {% endif %}
    {% endfor %}
    <li class="nav-item dropdown {% if node.active or activeChildren %}active{% endif %}">

But that seems a bit verbose. Any ideas here?

Additional info

  • Plugin version: 1.0.17.2
  • Craft version: 3.0.32

Allow changing of node type without deleting and re-creating

This is more of a feature request than a bug.

The inability to change the type of a node – for instance from Entry to Custom URL or vice versa – without deleting and re-creating it is a deal-breaker for me, especially given that you cannot delete a node without deleting all of it's children. This makes on-the-fly changes to taxonomy very cumbersome.

Entry nodes link to only 1 site's version

Description

When selecting an entry, the url in each site stays the same, which causes nodes to link to a different site.

For example:

  • Add a node to a contact page in site "FR" /fr/contact
  • Look at nav in site "NL", should be /nl/contact but it stays /fr/contact

Distinguish nodes that have alternative title

This is something usefull for translators.

When nodes just use its entry/category title, translator doesnt have any business manipulating menus. But if node uses alternative title, he has to translate this title.

Lets think of large menu with multiple levels and hundreds of nodes. Translator would have to check each node to find out if it uses alternative title that needs to be translated.

Some somple icon to distinguish such nodes from rest (along with manual nodes that also need to be translated) would make translator job easier.

Breadcrumbs?

Is a simple breadcrumbs functionality on your roadmap at all for the near future? e.g. craft.navigation.breadcrumbs. Or should I just build it using the active item from each nav level?

Internal server error in CMS Navigation > Site when sites are disabled at Sections > Site Settings

Description

There's an Internal server error (error log below) when you sites on a multisite installation and there's an entry created in all sites and you go a the disabled-site with the previously linked entry in the navigation plugin.

Log dump:
[Error] Error: Call to a member function displayName() on null in /var/www/html/vendor/verbb/navigation/src/elements/Node.php:104 Stack trace: #0 /var/www/html/vendor/verbb/navigation/src/elements/Node.php(95): verbb\navigation\elements\Node->getElement() #1 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): verbb\navigation\elements\Node->init() #2 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2225): yii\base\BaseObject->__construct(Array) #3 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2151): craft\elements\db\ElementQuery->_createElement(Array) #4 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1143): craft\elements\db\ElementQuery->_createElements(Array) #5 /var/www/html/vendor/yiisoft/yii2/db/Query.php(238): craft\elements\db\ElementQuery->populate(Array) #6 /var/www/html/vendor/craftcms/cms/src/db/Query.php(161): yii\db\Query->all(NULL) #7 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1172): craft\db\Query->all(NULL) #8 /var/www/html/vendor/twig/twig/lib/Twig/Extension/Core.php(1619): craft\elements\db\ElementQuery->all() #9 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(73): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(verbb\navigation\elements\db\NodeQuery), 'all', Array, 'method', false, false) #10 /var/www/html/storage/runtime/compiled_templates/cf/cf59384e2c064b0f2713d36c11cf3b0456614a4f7e42c6df619ef4eb711e2a00.php(126): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(verbb\navigation\elements\db\NodeQuery), 'all', Array, 'method') #11 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_db0daf1767ebd79700c0b1eccb4cd1c6f634764eb95a15c04ec0c9c60607fcbe->doDisplay(Array, Array) #12 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array) #13 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array) #14 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array) #15 /var/www/html/storage/runtime/compiled_templates/6b/6b57e6f61ea23335197272c7ac0a0aa7d5137a3ad138a77008b8202d821f1d7a.php(28): craft\web\twig\Template->display(Array, Array) #16 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_988a8365f2eec2b3a0e0ddf4f60d236e908bff01b816e23220ccd028994b5ae2->doDisplay(Array, Array) #17 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array) #18 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array) #19 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array) #20 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template->display(Array) #21 /var/www/html/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template->render(Array) #22 /var/www/html/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment->render('index', Array) #23 /var/www/html/vendor/craftcms/cms/src/web/View.php(378): craft\web\View->renderTemplate('index', Array) #24 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(155): craft\web\View->renderPageTemplate('index', Array) #25 /var/www/html/vendor/craftcms/cms/src/controllers/TemplatesController.php(78): craft\web\Controller->renderTemplate('index', Array) #26 [internal function]: craft\controllers\TemplatesController->actionRender('index', Array) #27 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #28 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #29 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('render', Array) #30 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('render', Array) #31 /var/www/html/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('templates/rende...', Array) #32 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array) #33 /var/www/html/vendor/craftcms/cms/src/web/Application.php(271): yii\web\Application->handleRequest(Object(craft\web\Request)) #34 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request)) #35 /var/www/html/public_html/index.php(42): yii\base\Application->run() #36 {main} 2018-10-08 10:35:31 [-][1][e0tjm7ava22taks0j22l65h262][info][application] $_GET = [ 'p' => 'locatie/den-haag' ]

Steps to reproduce

  1. Create a multisite
  2. Create an entry that's saved in all sites ( in a Channel for example 'pages' )
  3. Create a navigation with an item linked to the entry in all sites.*
  4. Go to Settings > Sections > Pages Channel settings.
  5. Disable all other sites, except the primary.
  6. Go back to the navigation. Now the primary site nav will work, but if you switch to a site you disabled previously, the error occurs.

*The probleem seems to occur even without even linking an entry (I removed the linked entry, before disabling some sites in the Channel settings and the same error at step 6 also occurs )

Additional info

  • Plugin version: 1.0.9
  • Craft version: 3.0.26.1

Custom URL not active

Description

When adding Custom URL which is simply a template in craft does not set active.

Steps to reproduce

  1. Create template in craft
  2. Add that template url to navigation as Custom URL

Additional info

  • Plugin version: latest
  • Craft version: latest

Example: I have created news template to list entries. I have added /news to navigation and want that to be active on both /news & /news/{entry-slug}. Basically if first segment is "news", is this possible?

Add getActiveNode Method

This method would be helpful when outputting a secondary level of navigation that isn't within the main navigation loop, for example top level navigation in the header and sidebar would show the children of the currently active parent.

{% set nodes = craft.navigation.getActiveNode() %

{% nav nodes in nodes %}
   {{ node.link }}	
{% endnav %}

Max Levels value doesn't do anything

Description

I set a value in the Max Values field for the menu in the CMS, but I'm able to add any number of nested items to the menu.

Steps to reproduce

  1. Create a new navigation. Set Max Levels to 1.
  2. Add items to the new navigation. Add children to the top-level items. Add children to the children items.

Additional info

  • Plugin version: 1.0.5
  • Craft version: 3.0.20

Template Not Found 404 in CMS which renders the plugin unusable

Description

Latest update 1.0.11 seems to throw a template 404 which renders the plugin unusable.

Template not found: navigation/navs/build/1&storedSiteId=1

Steps to reproduce

  1. Install plugin version 1.0.11
  2. add navigation
  3. Click on navigation to add entries

Additional info

  • Plugin version: 1.0.11
  • Craft version: 3.0.26.1

FR: Import data from the A&M Nav table into verbb/navigation on a Craft 3 setup

We are using the plugin as a replacement for https://github.com/am-impact/amnav. Seeing as there is a lack of updates from their side we are going to use it for all upgrades to C3 that we have to do moving forward. As far as we can see there currently isnt a first-party solution to import the nav and corresponding nodes from a&m's solution to verbb's.

We have been doing this by hand which is far from ideal.

Concretely: Would you be open to a PR that implements this as a first party solution via the settings screen in a one-click update 'style' implementation or is something like this being worked on already?

P.S Obviously i also have something to make up for the mistake in #42 #41 #34 😂😋🤕 so i hope you'll be up for it!

BUG: homepage always active

Description

When adding homepage to the menu node.active is always true on homepage link

Additional info

  • Plugin version: 1.0.2
  • Craft version: 3.16.01

yii\base\UnknownPropertyException

Description

Hi, sorry but I get an Error when I try to create a new Navigation. Clean Craft Install, fresh Navigation Install. I tried it in two different projects. Error as follows:

yii\base\UnknownPropertyException: Setting unknown property: verbb\navigation\records\Nav::propagateNodes in /Users/max/Sites/project/vendor/yiisoft/yii2/base/Component.php:209 Stack trace: #0 /Users/max/Sites/project/vendor/yiisoft/yii2/db/BaseActiveRecord.php(322): yii\base\Component->__set('propagateNodes', '1') #1 /Users/max/Sites/project/vendor/verbb/navigation/src/services/Navs.php(115): yii\db\BaseActiveRecord->__set('propagateNodes', '1') #2 /Users/max/Sites/project/vendor/verbb/navigation/src/controllers/NavsController.php(98): verbb\navigation\services\Navs->saveNav(Object(verbb\navigation\models\Nav)) #3 [internal function]: verbb\navigation\controllers\NavsController->actionSaveNav() #4 /Users/max/Sites/project/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #5 /Users/max/Sites/project/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #6 /Users/max/Sites/project/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('save-nav', Array) #7 /Users/max/Sites/project/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-nav', Array) #8 /Users/max/Sites/project/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('navigation/navs...', Array) #9 /Users/max/Sites/project/vendor/craftcms/cms/src/web/Application.php(538): craft\web\Application->runAction('navigation/navs...', Array) #10 /Users/max/Sites/project/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request)) #11 /Users/max/Sites/project/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request)) #12 /Users/max/Sites/project/web/index.php(21): yii\base\Application->run() #13 {main} Copy Stacktrace Search Stackoverflow Search Google Exception Unknown Property – yii\base\UnknownPropertyException Setting unknown property: verbb\navigation\records\Nav::propagateNodes

Steps to reproduce

  1. Install Navigate on Craft 3.0.22 (or 3.0.21) through Plugin Store
  2. Go to Navigation Tab
  3. Create new Navigation (tried different options)

Additional info

  • Plugin version: 1.0.8
  • Craft version: 3.0.22

Reduce amount of queries (eager loading)

Description

The nav bar seems to execute a very large amount of queries mostly just for showing a title and url for some entries.
Perhaps the navs could be loaded more efficiently or support for eager loading of the nodes and children can be added

Steps to reproduce

  1. Create a navbar with some entries linked to items
  2. Insert the navbar in a template using the docs '{{ craft.navigation.render('main', { ....' example
  3. watch the amount of queries

Additional info

  • Plugin version: 1.0.12
  • Craft version: 3.0.29

Option: UL attributes

Description

Add config option for adding extra attributes on the main ul tag.

Context: I'm working on a site with a JS library that does something to the menu based on the data- attributes on it.

I realise craft.navigation.nodes() can help with this, but on the other hand, you then have to set the other attributes (new window, active class etc.) manually.

Ability to add active class to render function

Description

It would be amazing if you could simply pass an additional class name to the render function to handle the current page/active links.

e.g.

{{ craft.navigation.render('navHandle', {
    ulClass: 'nav-items',
    liClass: 'nav-item',
    aClass: 'nav-link',
    activeClass: 'nav-active',
}) }}

FR: More/less options for user groups

It would be nice if there were some option for user groups: e.g. don't allow users to make new navigations. If there is only 1 navigation, and the user is not allowed to create new navigations, it would be nice if the user is redirected to edit that navigation.

Adding multiple navigation items resets addition settings on add.

Description

When adding a navigation item from the sidebar within a navigation, the parent element setting is reset when the item is added. Shouldn't the parent element setting remain the same as you are adding elements especially when you are loading a lot of manual elements. This may not be a problem from entries/categories/assets as you can add several at a time, but manual entry you need to reset it for each entry. Would be faster entry to have this setting remain until changed.

Steps to reproduce

  1. Go into a navigation.
  2. Go to manual url and change parent setting.
  3. Add item.
  4. Setting is reset.

Additional info

  • Plugin version: 1.0.3
  • Craft version: Solo 3.0.17.1

500 Server error

Description

I can't seem to age the plugin to work. I installed it without a problem but once I want to add something I get a 500 server error.

image

This is the response:

{"error":"unlink(/home/vagrant/code/storage/runtime/mutex/612840dcc6344894cc5672b58d1d48db.lock): Text file busy"}

What is strange is that craft.navigation.render() works but it can't render anything because its empty.

I am using Vagrant (Homestead) if that is of any use.

Steps to reproduce

  1. Install the plugin
  2. Go to the navigation
  3. Create a navigation
  4. Try to add something to it.

Additional info

  • Plugin version: 1.0.18
  • Craft version: 3.0.36

Set alternative title and classes before adding node

User can first set up "Open in new window" option before adding node, in right side column.
But to set up alternative title or css classes he has to first add node and than access settings of node. These settings should be possible to set up before creating node.

Multisite: Nodes are not bubbling to newly created site if navigation exists already

Description

If you have a navigation and add a site afterwards, the nodes are not bubbling.
Quick fix is to save every node in the previous existing site where you created the navigation. Then the node bubbles through the new site.

Steps to reproduce

  1. Create a multisite and add a navigation
  2. Then create a new site (now you have 2 or 3 sites)
  3. Switch to the navigation, then you'll see the nodes created in the navigation don't exist in the new site.

Can't install plugin - PostgreSQL

Description

Can't install plugin once added.

Steps to reproduce

  1. Click to install via the Plugin Store
  2. Head to Settings/Plugins and attempt to install
  3. Returns 'Couldn't install plugin.'

Additional info

  • PHP version: 7.1.19
  • PostgreSQL: 9.5.12
  • Craft Pro: 3.0.17.1

Dump of the erroring migration. Shout if you need anything else!

2018-07-28 13:11:52 [147.147.64.97][1][-][error][craft\db\MigrationManager::migrateUp] Failed to apply Install (time: 0.006s). Output:
    > create table {{%navigation_nodes}} ...Exception: SQLSTATE[42804]: Datatype mismatch: 7 ERROR:  column "newWindow" is of type boolean but default expression is of type integer
HINT:  You will need to rewrite or cast the expression.
The SQL being executed was: CREATE TABLE "navigation_nodes" (
	"id" integer NOT NULL,
	"elementId" integer,
	"navId" integer NOT NULL,
	"url" varchar(255),
	"type" varchar(255),
	"classes" varchar(255),
	"newWindow" boolean DEFAULT 0,
	"dateCreated" timestamp(0) NOT NULL,
	"dateUpdated" timestamp(0) NOT NULL,
	"uid" char(36) NOT NULL DEFAULT '0',
	PRIMARY KEY(id)
) (/mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/db/Schema.php:664)
#0 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'CREATE TABLE "n...')
#1 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('CREATE TABLE "n...')
#2 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/db/Migration.php(323): yii\db\Command->execute()
#3 /mnt/devski/vhosts/subdomains/rs/vendor/verbb/navigation/src/migrations/Install.php(45): yii\db\Migration->createTable('{{%navigation_n...', Array)
#4 /mnt/devski/vhosts/subdomains/rs/vendor/verbb/navigation/src/migrations/Install.php(22): verbb\navigation\migrations\Install->createTables()
#5 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/db/Migration.php(56): verbb\navigation\migrations\Install->safeUp()
#6 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration->up(true)
#7 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/base/Plugin.php(138): craft\db\MigrationManager->migrateUp(Object(verbb\navigation\migrations\Install))
#8 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/services/Plugins.php(476): craft\base\Plugin->install()
#9 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/controllers/PluginsController.php(48): craft\services\Plugins->installPlugin('navigation')
#10 [internal function]: craft\controllers\PluginsController->actionInstallPlugin()
#11 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('install-plugin', Array)
#14 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('install-plugin', Array)
#15 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('plugins/install...', Array)
#16 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/web/Application.php(538): craft\web\Application->runAction('plugins/install...', Array)
#17 /mnt/devski/vhosts/subdomains/rs/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /mnt/devski/vhosts/subdomains/rs/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /mnt/devski/vhosts/subdomains/rs/web/index.php(21): yii\base\Application->run()
#20 {main}

Unable to add entries on MultiSite

Description

When creating a new navigation in a multisite I am not able to add entries to a site other than the default site. No errors are flagged in the debug toolbar

Steps to reproduce

  1. Create new navigation
  2. Add navigation for the default site
  3. Switch to the second site
  4. Click on add entry
  5. Switch to entries for the second site in the modal
  6. Select an entry and click select
  7. No entry is added

Additional info

  • Plugin version: 1.0.2
  • Craft version: 3.16.01

Allow nodes without URLs

A nav may have a level of hierarchy only for display/grouping, with no actual URL to reflect.

Possible Approaches:

  • un-require url from the "Custom" type
  • make a new node type of "Group" (or something similar) that has no URL field.

Multi Language Support don't work.

Description

I have a Site with 6 Languages.
The Navigation URLs don´t change if I switch the Language. What did I wrong?
For example:
EN works fine - If I switch to ES the navigation still link to the EN pages.

Template Code:

{% set nodes = craft.navigation.nodes('main').all() %}
	<ul class="main">
	    {% nav node in nodes %}
	        <li>
	            {{ node.link }}
	           {% ifchildren %}
	               <ul>
	                   {% children %}
	               </ul>
	           {% endifchildren %}
	       </li>
	   {% endnav %}
	</ul>

Steps to reproduce

  1. Create a new Nav
  2. Enable Propagate nodes
  3. Have minimum 2 Languages

Additional info

  • Plugin version: 1.0.18
  • Craft version: 3.0.36

Unknown error occured while removing node

When i try to remove menu node, i sometimes get error - "unknown error occured" and node doesnt get removed. When i refresh page it turns out that node is removed after all.

I checked in inspector, and plugin gets this data from backend when i try to remove:

{"success":false}

There was also something about csrf token timeout, but i didnt managed to copy it. Despite message about timeout, i entered page just moment before, so there should not be time for something to timeout.

I use windows xampp.

My system info:

PHP version	7.2.1
Database driver & version	MySQL 5.5.5
Image driver & version	GD 7.2.1
Craft edition & version	Craft Solo 3.0.36
Yii version	2.0.15.1
Twig version	2.6.0
Guzzle version	6.3.3
Imagine version	0.7-dev

active when url is a child url

I'd love to have top level nav items show as active if I'm on a url which is clearly a child, even if the child isn't defined in the plugin.

e.g. <a href="/foo" class="active">Foo</a> when the full url is /foo/bar.

Bugfix on Query String.

Description

There is a bug in the index.html template which creates an incorrect query string variable that makes craft 404 template not found.

Steps to reproduce

  1. Use version 1.0.11
  2. Navigate to the index template.
  3. Click on any link, you'll see the URL is /build/1&storedSiteId=1
  4. This is not a valid query string, hence Craft throws a 404.

Additional info

  • Plugin version: 1.0.11
  • Craft version: 3.0.26.1

Setting unknown property: verbb\navigation\records\Nav::propagateNodes

Description

When creating a new navigation, i get this error: Setting unknown property: verbb\navigation\records\Nav::propagateNodes

Steps to reproduce

  1. Create a new navigation
  2. Save the navigation

Additional info

  • Plugin version: 1.0.7
  • Craft version: Craft Solo 3.0.21

Stack trace:

yii\base\UnknownPropertyException: Setting unknown property: verbb\navigation\records\Nav::propagateNodes in /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/db/BaseActiveRecord.php(322): yii\base\Component->__set('propagateNodes', '')
#1 /Users/username/Code/Sites/craftup/vendor/verbb/navigation/src/services/Navs.php(115): yii\db\BaseActiveRecord->__set('propagateNodes', '')
#2 /Users/username/Code/Sites/craftup/vendor/verbb/navigation/src/controllers/NavsController.php(98): verbb\navigation\services\Navs->saveNav(Object(verbb\navigation\models\Nav))
#3 [internal function]: verbb\navigation\controllers\NavsController->actionSaveNav()
#4 /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 /Users/username/Code/Sites/craftup/vendor/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('save-nav', Array)
#7 /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-nav', Array)
#8 /Users/username/Code/Sites/craftup/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('navigation/navs...', Array)
#9 /Users/username/Code/Sites/craftup/vendor/craftcms/cms/src/web/Application.php(538): craft\web\Application->runAction('navigation/navs...', Array)
#10 /Users/username/Code/Sites/craftup/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#11 /Users/username/Code/Sites/craftup/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#12 /Users/username/Code/Sites/craftup/web/index.php(21): yii\base\Application->run()
#13 /Users/username/.composer/vendor/laravel/valet/server.php(147): require('/Users/username/Co...')
#14 {main}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.