Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 0390642

Browse files
author
Matthew Hailwood
committed
Fix OwnerPermissionedDataObject relation class, Add new nav control methods to ChildlessPage and NavHolderPage
1 parent 114a2b9 commit 0390642

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

code/OwnerPermissionedDataObject.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class OwnerPermissionedDataObject extends DataObject {
1414
* @return DataObject
1515
*/
1616
protected function RelationOwner() {
17-
if ($this->hasMethod(self::$relationOwnerMethod)) {
18-
return $this->{self::$relationOwnerMethod}();
17+
if ($this->hasMethod(static::$relationOwnerMethod)) {
18+
return $this->{static::$relationOwnerMethod}();
1919
} else {
2020
throw new BadMethodCallException(
2121
sprintf('Method "%s" not found - Is %s::$relationOwnerMethod correct?', self::$relationOwnerMethod, get_class($this))
@@ -38,4 +38,4 @@ public function canDelete($member = null) {
3838
public function canCreate($member = null) {
3939
return $this->RelationOwner()->canCreate($member);
4040
}
41-
}
41+
}

code/PageTypes/ChildlessPage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
*/
1313
class ChildlessPage extends Page {
1414

15+
/**
16+
* Set to return true if this page should not show it's children in the nav
17+
*
18+
* @return bool
19+
*/
20+
public function HideChildrenFromNavigation() {
21+
return true;
22+
}
1523
}
1624

1725

code/PageTypes/NavHolderPage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
*/
1414
class NavHolderPage extends Page {
1515

16+
/**
17+
* Set to return false if this page should not be added to as the first child of it's dropdown list if it is a parent
18+
*
19+
* @return bool
20+
*/
21+
public function ShowInDropdownIfParent(){
22+
return false;
23+
}
1624
}
1725

1826

0 commit comments

Comments
 (0)