Code Duplication    Length = 13-13 lines in 5 locations

code/model/EditableCustomRule.php 1 location

@@ 111-123 (lines=13) @@
108
     * @param array $args List of arguments passed to canCreate
109
     * @return DataObject Some parent dataobject to inherit permissions from
110
     */
111
    protected function getCanCreateContext($args) {
112
        // Inspect second parameter to canCreate for a 'Parent' context
113
        if(isset($args[1]['Parent'])) {
114
            return $args[1]['Parent'];
115
        }
116
        // Hack in currently edited page if context is missing
117
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
118
            return Controller::curr()->currentPage();
119
        }
120
121
        // No page being edited
122
        return null;
123
    }
124
125
    /**
126
     * @param Member $member

code/model/editableformfields/EditableFormField.php 1 location

@@ 391-403 (lines=13) @@
388
     * @param array $args List of arguments passed to canCreate
389
     * @return SiteTree Parent page instance
390
     */
391
    protected function getCanCreateContext($args) {
392
        // Inspect second parameter to canCreate for a 'Parent' context
393
        if(isset($args[1]['Parent'])) {
394
            return $args[1]['Parent'];
395
        }
396
        // Hack in currently edited page if context is missing
397
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
398
            return Controller::curr()->currentPage();
399
        }
400
401
        // No page being edited
402
        return null;
403
    }
404
405
    /**
406
     * Check if can publish

code/model/editableformfields/EditableOption.php 1 location

@@ 88-100 (lines=13) @@
85
     * @param array $args List of arguments passed to canCreate
86
     * @return DataObject Some parent dataobject to inherit permissions from
87
     */
88
    protected function getCanCreateContext($args) {
89
        // Inspect second parameter to canCreate for a 'Parent' context
90
        if(isset($args[1]['Parent'])) {
91
            return $args[1]['Parent'];
92
        }
93
        // Hack in currently edited page if context is missing
94
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
95
            return Controller::curr()->currentPage();
96
        }
97
98
        // No page being edited
99
        return null;
100
    }
101
102
    /**
103
     * @param Member $member

code/model/recipients/UserDefinedForm_EmailRecipient.php 1 location

@@ 291-303 (lines=13) @@
288
     * @param array $args List of arguments passed to canCreate
289
     * @return SiteTree Parent page instance
290
     */
291
    protected function getCanCreateContext($args) {
292
        // Inspect second parameter to canCreate for a 'Parent' context
293
        if(isset($args[1]['Form'])) {
294
            return $args[1]['Form'];
295
        }
296
        // Hack in currently edited page if context is missing
297
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
298
            return Controller::curr()->currentPage();
299
        }
300
301
        // No page being edited
302
        return null;
303
    }
304
305
	/**
306
	 * @param Member

code/model/recipients/UserDefinedForm_EmailRecipientCondition.php 1 location

@@ 81-93 (lines=13) @@
78
     * @param array $args List of arguments passed to canCreate
79
     * @return SiteTree Parent page instance
80
     */
81
    protected function getCanCreateContext($args) {
82
        // Inspect second parameter to canCreate for a 'Parent' context
83
        if(isset($args[1]['Parent'])) {
84
            return $args[1]['Parent'];
85
        }
86
        // Hack in currently edited page if context is missing
87
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
88
            return Controller::curr()->currentPage();
89
        }
90
91
        // No page being edited
92
        return null;
93
    }
94
95
	/**
96
	 * @param Member