This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'SpiffyJr/pr/navigation-hotfixes'
- Loading branch information
73 parents
ff58ff4
+
5675884
+
a55ead5
+
47eb5a8
+
a36e34a
+
3e520ad
+
7b0d374
+
461c28b
+
3890e69
+
316384e
+
1431343
+
debad5a
+
1680741
+
4497a00
+
bb6633a
+
6b7ed03
+
35fcae3
+
0737e9d
+
c31bf4c
+
918649e
+
ecbe771
+
b4124fc
+
f4e1da0
+
a8c70a8
+
50d3c5d
+
79180fa
+
f6f9386
+
8ed6590
+
d79a4a4
+
3958052
+
eae6146
+
1cc7a46
+
1d9542f
+
a22d6e2
+
3496b67
+
9398e77
+
687d980
+
900dc7d
+
21f6363
+
0eeb6ff
+
8c442a3
+
adf1f8e
+
c2ceb18
+
9b17a1c
+
d5dab4a
+
346a62a
+
9808633
+
bdeec54
+
1a2506a
+
f5f3d02
+
b623064
+
4338bf4
+
bdababf
+
4054000
+
4449c16
+
d3d8b33
+
8427cf8
+
8d162ec
+
a988e9a
+
3e9d597
+
ee93c08
+
9d3ce53
+
f04a59c
+
0c3f2de
+
a654383
+
502d937
+
93350ca
+
23a0ccc
+
15dc071
+
6ca79e9
+
7645850
+
7b0843e
+
5a517b6
commit b9f38cc
Showing
4 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Navigation\Service; | ||
|
||
|
@@ -11,21 +30,42 @@ | |
use Zend\ServiceManager\ServiceLocatorInterface; | ||
use Zend\View\Helper\Url as UrlHelper; | ||
|
||
/** | ||
* Abstract navigation factory | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
abstract class AbstractNavigationFactory implements FactoryInterface | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $pages; | ||
|
||
/** | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return \Zend\Navigation\Navigation | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$pages = $this->getPages($serviceLocator); | ||
return new Navigation($pages); | ||
} | ||
|
||
/** | ||
* @abstract | ||
* @return string | ||
*/ | ||
abstract protected function getName(); | ||
|
||
/** | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return array | ||
* @throws \Zend\Navigation\Exception\InvalidArgumentException | ||
*/ | ||
protected function getPages(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
if (null === $this->pages) { | ||
|
@@ -51,6 +91,11 @@ protected function getPages(ServiceLocatorInterface $serviceLocator) | |
return $this->pages; | ||
} | ||
|
||
/** | ||
* @param string|\Zend\Config\Config|array $config | ||
* @return array|null|\Zend\Config\Config | ||
* @throws \Zend\Navigation\Exception\InvalidArgumentException | ||
*/ | ||
protected function getPagesFromConfig($config = null) | ||
{ | ||
if (is_string($config)) { | ||
|
@@ -73,15 +118,21 @@ protected function getPagesFromConfig($config = null) | |
return $config; | ||
} | ||
|
||
protected function injectComponents($pages, RouteMatch $routeMatch, UrlHelper $urlHelper) | ||
/** | ||
* @param array $pages | ||
* @param RouteMatch $routeMatch | ||
* @param UrlHelper $urlHelper | ||
* @return mixed | ||
*/ | ||
protected function injectComponents(array $pages, RouteMatch $routeMatch = null, UrlHelper $urlHelper = null) | ||
{ | ||
foreach($pages as &$page) { | ||
$hasMvc = isset($page['action']) || isset($page['controller']) || isset($page['route']); | ||
if ($hasMvc) { | ||
if (!isset($page['routeMatch'])) { | ||
if (!isset($page['routeMatch']) && $routeMatch) { | ||
$page['routeMatch'] = $routeMatch; | ||
} | ||
if (!isset($page['urlHelper'])) { | ||
if (!isset($page['urlHelper']) && $urlHelper) { | ||
$page['urlHelper'] = $urlHelper; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,58 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Navigation\Service; | ||
|
||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* Constructed factory to set pages during construction. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class ConstructedNavigationFactory extends AbstractNavigationFactory | ||
{ | ||
/** | ||
* @param string|\Zend\Config\Config|array $config | ||
*/ | ||
public function __construct($config) | ||
{ | ||
$this->pages = $this->getPagesFromConfig($config); | ||
} | ||
|
||
/** | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return array|null|\Zend\Config\Config | ||
*/ | ||
public function getPages(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
return $this->pages; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return 'constructed'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Navigation\Service; | ||
|
||
/** | ||
* Default navigation factory. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class DefaultNavigationFactory extends AbstractNavigationFactory | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
protected function getName() | ||
{ | ||
return 'default'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @subpackage View | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Navigation\View; | ||
|
||
use Zend\ServiceManager\ConfigurationInterface; | ||
use Zend\ServiceManager\ServiceManager; | ||
|
||
/** | ||
* Service manager configuration for navigation view helpers | ||
* | ||
* @category Zend | ||
* @package Zend_Navigation | ||
* @subpackage View | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class HelperConfiguration implements ConfigurationInterface | ||
{ | ||
/** | ||
* Configure the provided service manager instance with the configuration | ||
* in this class. | ||
* | ||
* In addition to using each of the internal properties to configure the | ||
* service manager, also adds an initializer to inject ServiceManagerAware | ||
* classes with the service manager. | ||
* | ||
* @param ServiceManager $serviceManager | ||
* @return void | ||
*/ | ||
public function configureServiceManager(ServiceManager $serviceManager) | ||
{ | ||
$serviceManager->setFactory('navigation', function($sm) { | ||
$helper = new \Zend\View\Helper\Navigation; | ||
$helper->setServiceLocator($sm); | ||
return $helper; | ||
}); | ||
} | ||
} |