Total Complexity | 6 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class AvoidChildDeletion extends SiteTreeExtension |
||
12 | { |
||
13 | public function updateCMSActions(FieldList $fields) |
||
14 | { |
||
15 | if ($this->hasChildrenOrIsTooImportant()) { |
||
16 | $phrase = _t(__CLASS__ . '.ReasonsThisPageCanNotBeDeleted', 'This page can not be archived because it has children or it is the home page.'); |
||
17 | $fields->addFieldsToTab( |
||
18 | 'ActionMenus.MoreOptions', |
||
19 | [ |
||
20 | LiteralField::create( |
||
21 | 'ArchiveNote', |
||
22 | ' |
||
23 | <div class=\'cms-sitetree-information\'> |
||
24 | <p class="meta-info" style="white-space: normal;">' . $phrase . '</p> |
||
25 | </div>' |
||
26 | ), |
||
27 | ] |
||
28 | ); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | public function canDelete($member = null) |
||
33 | { |
||
34 | return $this->canArchive($member); |
||
35 | } |
||
36 | |||
37 | public function canArchive($member = null) |
||
40 | } |
||
41 | |||
42 | protected function hasChildrenOrIsTooImportant(): bool |
||
50 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths