| @@ 112-125 (lines=14) @@ | ||
| 109 | * @param array $args List of arguments passed to canCreate |
|
| 110 | * @return DataObject Some parent dataobject to inherit permissions from |
|
| 111 | */ |
|
| 112 | protected function getCanCreateContext($args) |
|
| 113 | { |
|
| 114 | // Inspect second parameter to canCreate for a 'Parent' context |
|
| 115 | if (isset($args[1]['Parent'])) { |
|
| 116 | return $args[1]['Parent']; |
|
| 117 | } |
|
| 118 | // Hack in currently edited page if context is missing |
|
| 119 | if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { |
|
| 120 | return Controller::curr()->currentPage(); |
|
| 121 | } |
|
| 122 | ||
| 123 | // No page being edited |
|
| 124 | return null; |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * @param Member $member |
|
| @@ 544-557 (lines=14) @@ | ||
| 541 | * @param array $args List of arguments passed to canCreate |
|
| 542 | * @return SiteTree Parent page instance |
|
| 543 | */ |
|
| 544 | protected function getCanCreateContext($args) |
|
| 545 | { |
|
| 546 | // Inspect second parameter to canCreate for a 'Parent' context |
|
| 547 | if (isset($args[1]['Parent'])) { |
|
| 548 | return $args[1]['Parent']; |
|
| 549 | } |
|
| 550 | // Hack in currently edited page if context is missing |
|
| 551 | if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { |
|
| 552 | return Controller::curr()->currentPage(); |
|
| 553 | } |
|
| 554 | ||
| 555 | // No page being edited |
|
| 556 | return null; |
|
| 557 | } |
|
| 558 | ||
| 559 | /** |
|
| 560 | * checks whether record is new, copied from SiteTree |
|
| @@ 130-143 (lines=14) @@ | ||
| 127 | * @param array $args List of arguments passed to canCreate |
|
| 128 | * @return SiteTree Parent page instance |
|
| 129 | */ |
|
| 130 | protected function getCanCreateContext($args) |
|
| 131 | { |
|
| 132 | // Inspect second parameter to canCreate for a 'Parent' context |
|
| 133 | if (isset($args[1]['Parent'])) { |
|
| 134 | return $args[1]['Parent']; |
|
| 135 | } |
|
| 136 | // Hack in currently edited page if context is missing |
|
| 137 | if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { |
|
| 138 | return Controller::curr()->currentPage(); |
|
| 139 | } |
|
| 140 | ||
| 141 | // No page being edited |
|
| 142 | return null; |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * @param Member |
|