Navigation component from Zend Framework

Overview
Comments
  • Added zend-expressive support - fixes #56

    Added zend-expressive support - fixes #56

    This proposal does not change existing classes of the component, because I wanted an implementation for version 2 of zend-navigation.

    Caution

    This PR based on PHPUnit 5.7 || 6.0! See: #59

    ping @weierophinney @RalfEggert @webimpress

    enhancement documentation needed 
    opened by froschdesign 29
  • problem with github markdown parser

    problem with github markdown parser

    Hello,

    following a short discussion with @froschdesign I report an issue with the github markdown parser regarding pipe symbols.

    The pipe sign | in markdown has a special meaning for tables and must therefore be commented out if used otherwise. As an example, have a look at the table in menu.md.

    The final documentation doesn't show the error, but github and maybe other markdown parsers do.

    Cheers, LT.

    bug enhancement work in progress 
    opened by lowtower 19
  • Failed test with all latest components at version 2.x

    Failed test with all latest components at version 2.x

    From Fedora CI https://apps.fedoraproject.org/koschei/package/php-zendframework-zend-navigation

    After upgrade of zend-mvc to 2.7.3 and zend-view-2.6.4

    PHPUnit 5.2.10 by Sebastian Bergmann and contributors.
    ...............................................................  63 / 179 ( 35%)
    ............................................................... 126 / 179 ( 70%)
    .................................................PHP Fatal error:  Call to a member function attach() on boolean in /usr/share/php/Zend/View/Helper/Navigation/AbstractHelper.php on line 959
    

    In travis build some component are 3.x (at least zend-stdlib)

    opened by remicollet 16
  • Quick Start guide wrong, twice

    Quick Start guide wrong, twice

    The quick start guide is wrong. First (small) issue, it has a very obvious syntax error https://docs.zendframework.com/zend-navigation/quick-start/. Look at the array( part in the first code block.

    The second issue is worse, and it is plain wrong and its one of the weirdest parts of the navigation module in my opinion. It says to use <?= $this->navigation('default')->menu() ?>, but you will get an error then. You have to use <?= $this->navigation('navigation')->menu() ?> instead.

    bug documentation 
    opened by RonnieHuibregtse 12
  • Fatal error: 'continue' not in the 'loop' or 'switch' context in /zend-view/src/Helper/Navigation/PluginManager.php on line 62

    Fatal error: 'continue' not in the 'loop' or 'switch' context in /zend-view/src/Helper/Navigation/PluginManager.php on line 62

    It's originally I commented at https://github.com/zendframework/zend-view/issues/45. I use latest zf2 :

    "zendframework/zendframework": "^2.5"
    

    The stacktrace is:

    Fatal error: 'continue' not in the 'loop' or 'switch' context in /Users/samsonasik/www/MyProject/vendor/zendframework/zend-view/src/Helper/Navigation/PluginManager.php on line 62
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0002  368728  {main}( )   .../index.php:0
    2   0.0843  4939896 Zend\Mvc\Application->run( )    .../index.php:21
    3   0.0945  5351360 Zend\Mvc\Application->completeRequest( )    .../Application.php:328
    4   0.0945  5351360 Zend\EventManager\EventManager->trigger( )  .../Application.php:353
    5   0.0945  5351416 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:214
    6   0.0947  5353104 call_user_func:{/Users/samsonasik/www/MyProject/vendor/zendframework/zend-eventmanager/src/EventManager.php:490} ( )    .../EventManager.php:490
    7   0.0947  5353104 Zend\Mvc\View\Http\DefaultRenderingStrategy->render( )  .../EventManager.php:490
    8   0.0947  5353104 Zend\View\View->render( )   .../DefaultRenderingStrategy.php:103
    9   0.1215  5373872 Zend\View\Renderer\PhpRenderer->render( )   .../View.php:207
    10  0.1217  5411144 include( '/Users/samsonasik/www/MyProject/module/Application/view/layout/layout.phtml' )    .../PhpRenderer.php:502
    11  0.1331  5936048 Zend\View\Helper\Navigation->menu( )    .../layout.phtml:55
    12  0.1331  5936104 Zend\View\Helper\Navigation->__call( )  .../layout.phtml:55
    13  0.1331  5936104 Zend\View\Helper\Navigation->findHelper( )  .../Navigation.php:112
    14  0.1331  5936104 Zend\View\Helper\Navigation->getPluginManager( )    .../Navigation.php:151
    15  0.1331  5936104 spl_autoload_call ( )   .../Navigation.php:325
    16  0.1331  5936264 Composer\Autoload\ClassLoader->loadClass( ) .../Navigation.php:325
    17  0.1331  5936424 Composer\Autoload\includeFile( )    .../ClassLoader.php:301
    
    bug 
    opened by samsonasik 10
  • Wrong method signatur in AbstractNavigationFactory

    Wrong method signatur in AbstractNavigationFactory

    https://github.com/zendframework/zend-navigation/blob/master/src/Service/AbstractNavigationFactory.php#L56

    Method createService has a wrong signature implementing Zend\ServiceManager\FactoryInterface. It should be createService(ServiceLocatorInterface $serviceLocator); with just one parameter!

    As of PHP 7.2 you'll receive a Fatal Error.

    bug 
    opened by DennisDobslaf 8
  • Zend\Navigation\AbstractContainer->hasChildren() does not seem to work correctly

    Zend\Navigation\AbstractContainer->hasChildren() does not seem to work correctly

    Hello,

    After trying for a few hours to make the zend navigation work, when upgrading from ZF2(2.4) to ZF3, i think i have found a problem with method: Zend\Navigation\AbstractContainer->hasChildren() In the past it used to work like this (in ZF 2.4):

    • it would return true if page on which method was called had child pages; Now it does not work like this, but does the following:
    • it returns true if first child of current page (on which method is called) has child pages
    • this seems not ok to me, but i may be wrong;

    Is this a problem or not ?

    Thank you !

    question 
    opened by andreidiaconescu 7
  • Order on n-level (n>1)

    Order on n-level (n>1)

    In the following example i create a navigation with two levels and then print the navigation labels with echo. As you can see i set an order for both first level pages and for two second level pages. If you look at my output you can see that only the first level pages are in right order. The second level pages arent in right order.

    For every level you put in a navigation greater than level one, the order isnt changed.

    Anybody of you have the same problem or can tell me what iam doing wrong? Or is this a not given functionality of this module?

    Testscript

    $container = new \Zend\Navigation\Navigation(
        array(
            array(
                'label' => 'ACL page 1 (guest)',
                'uri' => '#acl-guest',
                'resource' => 'nav-guest',
                'order' => 777,
                'pages' => array(
                     array(
                         'label' => 'ACL page 1.1 (foo)',
                          'uri' => '#acl-foo',
                          'resource' => 'nav-foo',
                          'order' => 666
                      ),
                      array(
                          'label' => 'ACL page 1.2 (bar)',
                           'uri' => '#acl-bar',
                           'resource' => 'nav-bar',
                      ),
                      array(
                          'label' => 'ACL page 1.3 (baz)',
                           'uri' => '#acl-baz',
                           'resource' => 'nav-baz',
                      ),
                      array(
                          'label' => 'ACL page 1.4 (bat)',
                          'uri' => '#acl-bat',
                          'resource' => 'nav-bat',
                          'order' => 111
                      ),
                  ),
              ),
              array(
                  'label' => 'ACL page 2 (member)',
                  'uri' => '#acl-member',
                  'resource' => 'nav-member',
                  'order' => 555
              )
          )
      );
    
      foreach ($container as $page) {
          echo $page->label."<br>";
          if ($page->hasPages()) {
              foreach ($page->getPages() as $page2) {
                  echo $page2->label."<br>";
              }
          }
      }
      die("ASD");
    

    Output

    ACL page 2 (member)
    ACL page 1 (guest)
    ACL page 1.1 (foo)
    ACL page 1.2 (bar)
    ACL page 1.3 (baz)
    ACL page 1.4 (bat)
    ASD
    
    opened by FabianKoestring 5
  • Zend Navigation with Zend Expressive  - localization ?

    Zend Navigation with Zend Expressive - localization ?

    hi, i have a little question about Zend Navigataion. After following cookbook tutorial about setting locale without url param (https://docs.zendframework.com/zend-expressive/cookbook/setting-locale-without-routing-parameter/) i am a bit confused so maybe someone can help me here.

    If i enter url like local.com/en/some-page my locale is set to english and all urls created with UrlHelper get '/en' part prepended but Zend Navigation is still rendering url without that '/en' part.

    What should i do to make Zend Navigation prepend that '/en/' part to all created links just like UrlHelper? ps. i am using froschdesign/zend-navigation - feature/expressive-support branch

    enhancement 
    opened by unnamed666 4
  • Compatibility of legacy SM2 style in PHP 7.2.

    Compatibility of legacy SM2 style in PHP 7.2.

    Fix #69. No need to dynamically request service name, when its known that Navigation::class is one ultimately being requested in __invoke

    Test will not run against 7.2 because #59 is against dev, while that branch is probably tested against SM3 making this less relevant. Although, test for general creation ability can be ported to improve coverage.

    opened by alextech 2
  • Trouble with multiple navigations in ZF3

    Trouble with multiple navigations in ZF3

    I've created navigation in the configuration file, according to example in Quick Star documentation. It worked with single menu, but once I've tried multiple menu approach I receive the following error:

    Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: Unable to resolve service "ZendNavigationDefault" to a factory; are you certain you provided it during configuration?

    The way I call the methof {% for page in navigation('Zend\Navigation\Default').container %} <a href="{{ url(page.route) }}" class="navbar-item">{{ page.label }}</a> {% endfor %}

    question 
    opened by rustedwolf 2
  • Zend\Navigation does not work with Zend\Expressive

    Zend\Navigation does not work with Zend\Expressive

    I want to use Zend\Navigation in a Zend\Expressive application. First of all, I installed it:

    composer require zendframework/zend-navigation
    

    Composer installed it and added the ConfigProvider to my /config/config.php file:

    $configManager = new ConfigManager(
        [
            Zend\I18n\ConfigProvider::class,
            Zend\Form\ConfigProvider::class,
            Zend\InputFilter\ConfigProvider::class,
            Zend\Hydrator\ConfigProvider::class,
            Zend\Session\ConfigProvider::class,
            TravelloViewHelper\ConfigProvider::class,
            new PhpFileProvider($pattern),
        ],
        $cachedConfigFile
    );
    

    When I try to use the navigation view helper in a template, I get this error:

    A plugin by the name "navigation" was not found in the plugin manager Zend\View\HelperPluginManager

    So, I added the Zend\Navigation\View\ViewHelperManagerDelegatorFactory to my configuration:

    return [
        'dependencies' => [
            'delegators' => [
                Zend\View\HelperPluginManager::class => [
                    Zend\Navigation\View\ViewHelperManagerDelegatorFactory::class,
                ],
            ],
        ],
    ];
    

    No I get this error:

    Unable to resolve service "Application" to a factory; are you certain you provided it during configuration?

    After some investigation the problem is located here:

    https://github.com/zendframework/zend-navigation/blob/master/src/Service/AbstractNavigationFactory.php#L102

    The AbstractNavigationFactory seems to have a hard dependency on the MVC application which makes it impossible to use Zend\Navigation with Zend\Expressive currently.

    Are there any plans to solve this? What should be done to break up this hard dependency? I guess it would be quite complicated to run Zend\Navigation both with Zend\Mvc and Zend\Expressive, wouldn't it?

    enhancement work in progress documentation needed 
    opened by RalfEggert 36
  • Documentation seems to be wrong ...

    Documentation seems to be wrong ...

    I found this code snippet in den documenation for the zend-navigation component (ZF3):

    Docs » Reference » View Helpers » Intro

    The Code snippet provided is not working for me:

    <?php
    // module/MyModule/Module.php
    
    namespace MyModule;
    
    use Zend\View\HelperPluginManager;
    use Zend\Permissions\Acl\Acl;
    use Zend\Permissions\Acl\Role\GenericRole;
    use Zend\Permissions\Acl\Resource\GenericResource;
    
    class Module
    {
        /* ... */
        public function getViewHelperConfig()
        {
            return [
                'factories' => [
                    // This will overwrite the native navigation helper
                    'navigation' => function(HelperPluginManager $pm) {
                        // Setup ACL:
                        $acl = new Acl();
                        $acl->addRole(new GenericRole('member'));
                        $acl->addRole(new GenericRole('admin'));
                        $acl->addResource(new GenericResource('mvc:admin'));
                        $acl->addResource(new GenericResource('mvc:community.account'));
                        $acl->allow('member', 'mvc:community.account');
                        $acl->allow('admin', null);
    
                        // Get an instance of the proxy helper
                        $navigation = $pm->get('Zend\View\Helper\Navigation');
    
                        // Store ACL and role in the proxy helper:
                        $navigation->setAcl($acl);
                        $navigation->setRole('member');
    
                        // Return the new navigation helper instance
                        return $navigation;
                    }
                ]
            ];
        }
        /* ... */
    }
    

    First it seems that in ZF3 the HelperPluginManager is not passed to the closure. Instead, I found out that the parent ServiceManager is passed.

    If I change it to the code below, then the example is working for me:

    class Module
    {
        /* ... */
        public function getViewHelperConfig()
        {
            return [
                'factories' => [
                    // This will overwrite the native navigation helper
                    Helper\Navigation::class => function(\Zend\ServiceManager\ServiceLocatorInterface $serviceManager)
                    {
                        $navigationViewHelper = new \Zend\View\Helper\Navigation();
                        $navigationViewHelper->setServiceLocator($serviceManager);
    
                        // Store ACL and role in the proxy helper:
                        $navigationViewHelper->setAcl($this->acl);
                        $navigationViewHelper->setRole($this->role);
    
                        // Return the new navigation helper instance
                        return $navigationViewHelper;
                    }
                ]
            ];
        }
        /* ... */
    }
    

    Am I right? Is the documentation for ZF3 not correct?

    bug documentation 
    opened by ksba 18
  • Update HelperConfigTest once zend-view refactor is complete

    Update HelperConfigTest once zend-view refactor is complete

    The HelperConfigTest test case is marked incomplete currently due to the fact that Zend\View\Navigation\PluginManager is not updated to the latest zend-servicemanager changes. Once it has been, we can address this test case.

    bug Test 
    opened by weierophinney 3
Releases(release-2.9.1)
  • release-2.9.1(Aug 21, 2019)

  • release-2.9.0(Apr 25, 2018)

  • release-2.8.0(Jun 11, 2016)

    Added

    • #33 adds support for zend-mvc v3.0. Specifically, the Mvc page type now allows usage of either Zend\Mvc\Router or Zend\Router for URI generation.

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • Nothing.
    Source code(tar.gz)
    Source code(zip)
  • release-2.7.2(Jun 11, 2016)

    Added

    • #27 adds and publishes the documentation to https://zendframework.github.io/zend-navigation/

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • #35 fixes errors in the ConfigProvider that prevented its use.
    Source code(tar.gz)
    Source code(zip)
  • release-2.7.1(Apr 11, 2016)

    Added

    • Nothing.

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • This release removes the erroneous calls to getViewHelperConfig() in the ConfigProvider and Module classes.
    Source code(tar.gz)
    Source code(zip)
  • release-2.7.0(Apr 11, 2016)

    Added

    • #26 adds:
      • Zend\Navigation\View\ViewHelperManagerDelegatorFactory, which decorates the ViewHelperManager service to configure it using Zend\Navigation\View\HelperConfig.
      • ConfigProvider, which maps the default navigation factory and the navigation abstract factory, as well as the navigation view helper.
      • Module, which does the same as the above, but for zend-mvc applications.

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • Nothing.
    Source code(tar.gz)
    Source code(zip)
  • release-2.6.1(Mar 21, 2016)

    Added

    • Nothing.

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • #25 ups the minimum zend-view version to 2.6.5, to bring in a fix for a circular dependency issue in the navigation helpers.
    Source code(tar.gz)
    Source code(zip)
  • release-2.6.0(Feb 24, 2016)

Owner
Zend Framework
Zend Framework
Db component from Zend Framework

zend-db Repository abandoned 2019-12-31 This repository has moved to laminas/laminas-db. Zend\Db is a component that abstract the access to a Database

Zend Framework 98 Sep 5, 2022
Debug component from Zend Framework

zend-debug Zend\Debug is a component that help the debugging of PHP applications. In particular it offers a static method Zend\Debug\Debug::dump() tha

Zend Framework 12 Jan 29, 2020
Json component from Zend Framework

zend-json Repository abandoned 2019-12-31 This repository has moved to laminas/laminas-json. Zend\Json provides convenience methods for serializing na

Zend Framework 102 Nov 17, 2022
Magento 2 Megamenu extension is an indispensable component, and plays the role of website navigation to help customers easily categorize and find information

Mageno 2 Mega Menu (Magicmenu) helps you create neat and smart navigation menus to display the main categories on your website.

https://magepow.com 35 Dec 1, 2022
A panel created based on the Zend Framework MVC framework

?? Painel MyZap2.0 Com ZendFramework 3 Descrição Esse é um painel criado como estudo pessoal do framework (Zend Framework MVC) não foi criado para fin

Jonathan Henrique 9 Jun 10, 2022
Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation.

Envbar Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation. This should help backend users

Magenizr 6 Oct 7, 2022
A simple helper to generate and display pagination navigation links

Intro to CHocoCode Paginator Friendly PHP paginator to paginate everything This package introduces a different way of pagination handling. You can rea

faso-dev 3 Aug 24, 2021
Twig extensions for common navigation widgets for symfony.

Twig Navigation Extension This bundle provides a Twig extensions for common navigation widgets. Installation composer require m2mtech/twig-navigation-

Martin Mandl 1 Feb 23, 2022
zend-memory manages data in an environment with limited memory

Memory objects (memory containers) are generated by the memory manager, and transparently swapped/loaded when required.

Zend Framework 16 Aug 29, 2020
Very easy to use a current limiting component, the code is very simple, based on the webman framework.

Very easy to use a current limiting component, the code is very simple, based on the webman framework.

nsp-team 13 Dec 29, 2022
Iranian wallet provider's integration component for Laravel Framework

Iranian Wallets Integration Component For Laravel Iranian Wallet provider integration handler for Laravel 8.1+ known as LaraWallet component completel

PHP Monsters 11 Dec 26, 2022
A PHP component to convert HTML into a plain text format

html2text html2text is a very simple script that uses DOM methods to convert HTML into a format similar to what would be rendered by a browser - perfe

Jevon Wright 423 Dec 29, 2022
Powerful and flexible component for building site breadcrumbs.

Phalcon Breadcrumbs Phalcon Breadcrumbs is a powerful and flexible component for building site breadcrumbs. You can adapt it to your own needs or impr

Serghei Iakovlev 40 Nov 5, 2022
This component provides a collection of functions/classes using the symfony/intl package when the Intl extension is not installed.

Symfony Polyfill / Intl: ICU This package provides fallback implementations when the Intl extension is not installed. It is limited to the "en" locale

Symfony 2.4k Jan 6, 2023
Debug - The Debug component provides tools to ease debugging PHP code.

Debug Component CAUTION: this component is deprecated since Symfony 4.4. Instead, use the ErrorHandler component. The Debug component provides tools t

Symfony 7.3k Jan 8, 2023
The Cache component provides an extended PSR-6 implementation for adding cache to your applications.

Symfony PSR-6 implementation for caching The Cache component provides an extended PSR-6 implementation for adding cache to your applications. It is de

Symfony 3.8k Jan 3, 2023
Messaging solutions for PHP - It contains advanced features build on top of a transport component

It contains advanced features build on top of a transport component. Client component kind of plug and play things or consumption component that simplify message processing a lot. Read more about it in documentation.

Enqueue 175 Jan 3, 2023
This component changes the way Magento 2 generates Interceptor classes

ABOUT This component changes the way Magento 2 generates Interceptor classes (a mechanism that allows plugins to work together). Instead of generating

Creatuity Corp. 64 Dec 5, 2022
This component simplifies file validation and uploading.

This component simplifies file validation and uploading.

Brandon Savage 1.7k Dec 27, 2022