Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Prepping for 2.2.0RC1.
  • Loading branch information
weierophinney committed May 1, 2013
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/Page/AbstractPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ abstract class AbstractPage extends AbstractContainer
*/
protected $privilege;

/**
* Permission associated with this page
*
* @var string|null
*/
protected $permission;

/**
* Whether this page should be considered active
*
Expand Down Expand Up @@ -700,6 +707,31 @@ public function getPrivilege()
return $this->privilege;
}

/**
* Sets permission associated with this page
*
* @param string|null $permission [optional] permission to associate
* with this page. Default is null, which
* sets no permission.
*
* @return AbstractPage fluent interface, returns self
*/
public function setPermission($permission = null)
{
$this->permission = is_string($permission) ? $permission : null;
return $this;
}

/**
* Returns permission associated with this page
*
* @return string|null permission or null
*/
public function getPermission()
{
return $this->permission;
}

/**
* Sets whether page should be considered active or not
*
Expand Down Expand Up @@ -1127,6 +1159,7 @@ public function toArray()
'order' => $this->getOrder(),
'resource' => $this->getResource(),
'privilege' => $this->getPrivilege(),
'permission' => $this->getPermission(),
'active' => $this->isActive(),
'visible' => $this->isVisible(),
'type' => get_class($this),
Expand Down
2 changes: 1 addition & 1 deletion src/Page/Mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Zend\Navigation\Page;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\Router\RouteMatch;
use Zend\Mvc\Router\RouteStackInterface;
use Zend\Navigation\Exception;
use Zend\Mvc\ModuleRouteListener;

/**
* Represents a page that is defined using controller, action, route
Expand Down
1 change: 1 addition & 0 deletions test/Page/MvcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ public function testToArrayMethod()

$options['privilege'] = null;
$options['resource'] = null;
$options['permission'] = null;
$options['pages'] = array();
$options['type'] = 'Zend\Navigation\Page\Mvc';

Expand Down
3 changes: 3 additions & 0 deletions test/Page/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ public function testToArrayMethod()

'resource' => 'joker',
'privilege' => null,
'permission' => null,

'foo' => 'bar',
'meaning' => 42,
Expand All @@ -1117,6 +1118,7 @@ public function testToArrayMethod()
'order' => null,
'resource' => null,
'privilege' => null,
'permission' => null,
'active' => null,
'visible' => 1,
'pages' => array(),
Expand All @@ -1136,6 +1138,7 @@ public function testToArrayMethod()
'order' => null,
'resource' => null,
'privilege' => null,
'permission' => null,
'active' => null,
'visible' => 1,
'pages' => array(),
Expand Down

0 comments on commit bbfc15c

Please sign in to comment.