Completed
Push — master ( 8a426a...d14e00 )
by
unknown
18s
created

InternalLinkModalExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOwner() 0 6 1
A editorInternalLink() 0 6 1
1
<?php
2
3
namespace SilverStripe\CMS\Forms;
4
5
use SilverStripe\Admin\ModalController;
6
use SilverStripe\Core\Extension;
7
use SilverStripe\Forms\Form;
8
9
/**
10
 * Decorates ModalController with insert internal link
11
 * @see ModalController
12
 */
13
class InternalLinkModalExtension extends Extension
14
{
15
    private static $allowed_actions = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
16
        'editorInternalLink',
17
    );
18
19
    /**
20
     * @return ModalController
21
     */
22
    public function getOwner()
23
    {
24
        /** @var ModalController $owner */
25
        $owner = $this->owner;
26
        return $owner;
27
    }
28
29
30
    /**
31
     * Form for inserting internal link pages
32
     *
33
     * @return Form
34
     */
35
    public function editorInternalLink()
36
    {
37
        /** @var InternalLinkFormFactory $factory */
38
        $factory = InternalLinkFormFactory::singleton();
39
        return $factory->getForm($this->getOwner(), "editorInternalLink");
40
    }
41
}
42