Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-1300

Vertical Navigation isShowVerticalNavigation returns incorrect value

XMLWordPrintable

    • Yes

      The method createVerticalNavigation() correctly checks the start level, but the method isShowVerticalNavigation() does not. Affecting everything that uses the vertical navigation.

          public boolean isShowVerticalNavigation() {
              try {
                  if(isShowHorizontalNavigation() && siteRoot.getDepth() + this.getHorizontalLevel() > currentNode.getDepth() ){
                      return false;
                  }
                  final boolean enabled = siteNavigation.getVertical().getEnabled();
                  final boolean empty = createVerticalNavigation().getItems().isEmpty();
                  return enabled && !empty;
              }
              catch (RepositoryException e) {
                  log.error("Can't check existence of vertical navigation",e);
                  return false;
              }
          }
      

      Should be something like:

          public boolean isShowVerticalNavigation() {
              int startlevel = siteNavigation.getVertical().getStartLevel() > 0 ? siteNavigation.getVertical().getStartLevel() : startLevel + getHorizontalLevel();
              try {
                  if(isShowHorizontalNavigation() && siteRoot.getDepth() + startLevel > currentNode.getDepth() ){
                      return false;
                  }
                  final boolean enabled = siteNavigation.getVertical().getEnabled();
                  final boolean empty = createVerticalNavigation().getItems().isEmpty();
                  return enabled && !empty;
              }
              catch (RepositoryException e) {
                  log.error("Can't check existence of vertical navigation",e);
                  return false;
              }
          }
      

        Acceptance criteria

              pmundt Philip Mundt
              rulate Ricardo Ulate
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: