Code Duplication    Length = 14-14 lines in 5 locations

code/model/EditableCustomRule.php 1 location

@@ 122-135 (lines=14) @@
119
     * @param array $args List of arguments passed to canCreate
120
     * @return DataObject Some parent dataobject to inherit permissions from
121
     */
122
    protected function getCanCreateContext($context)
123
    {
124
        // Inspect second parameter to canCreate for a 'Parent' context
125
        if (isset($context['Parent'])) {
126
            return $context['Parent'];
127
        }
128
        // Hack in currently edited page if context is missing
129
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
130
            return Controller::curr()->currentPage();
131
        }
132
133
        // No page being edited
134
        return null;
135
    }
136
137
    /**
138
     * @param Member $member

code/model/editableformfields/EditableFormField.php 1 location

@@ 471-484 (lines=14) @@
468
     * @param array $args List of arguments passed to canCreate
469
     * @return SiteTree Parent page instance
470
     */
471
    protected function getCanCreateContext($context)
472
    {
473
        // Inspect second parameter to canCreate for a 'Parent' context
474
        if (isset($context['Parent'])) {
475
            return $context['Parent'];
476
        }
477
        // Hack in currently edited page if context is missing
478
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
479
            return Controller::curr()->currentPage();
480
        }
481
482
        // No page being edited
483
        return null;
484
    }
485
486
    /**
487
     * Check if can publish

code/model/editableformfields/EditableOption.php 1 location

@@ 122-135 (lines=14) @@
119
     * @param array $args List of arguments passed to canCreate
120
     * @return DataObject Some parent dataobject to inherit permissions from
121
     */
122
    protected function getCanCreateContext($context)
123
    {
124
        // Inspect second parameter to canCreate for a 'Parent' context
125
        if(isset($context['Parent'])) {
126
            return $context['Parent'];
127
        }
128
        // Hack in currently edited page if context is missing
129
        if(Controller::has_curr() && Controller::curr() instanceof CMSMain) {
130
            return Controller::curr()->currentPage();
131
        }
132
133
        // No page being edited
134
        return null;
135
    }
136
137
    /**
138
     * @param Member $member

code/model/recipients/UserDefinedForm_EmailRecipient.php 1 location

@@ 345-358 (lines=14) @@
342
     * @param array $args List of arguments passed to canCreate
343
     * @return SiteTree Parent page instance
344
     */
345
    protected function getCanCreateContext($context)
346
    {
347
        // Inspect second parameter to canCreate for a 'Parent' context
348
        if (isset($context['Form'])) {
349
            return $context['Form'];
350
        }
351
        // Hack in currently edited page if context is missing
352
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
353
            return Controller::curr()->currentPage();
354
        }
355
356
        // No page being edited
357
        return null;
358
    }
359
360
    /**
361
     * @param Member

code/model/recipients/UserDefinedForm_EmailRecipientCondition.php 1 location

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