Completed
Push — master ( 9de5ff...fc4463 )
by Beñat
03:57
created

PageFields::removeScreenAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015 LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\WPFoundation\PostTypes\Fields\Templates;
13
14
use LIN3S\WPFoundation\PostTypes\Fields\Fields;
15
16
/**
17
 * Abstract page fields class that extends the fields basic
18
 * behaviour, implementing the "connector" and "removeScreenAttributes"
19
 * methods with the common use case.
20
 *
21
 * @author Beñat Espiña <[email protected]>
22
 */
23
abstract class PageFields extends Fields
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function connector()
29
    {
30
        return [
31
            [
32
                [
33
                    'param'    => 'post_type',
34
                    'operator' => '==',
35
                    'value'    => 'page',
36
                ],
37
                [
38
                    'param'    => 'page_template',
39
                    'operator' => '==',
40
                    'value'    => $this->name,
41
                ],
42
            ],
43
        ];
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function removeScreenAttributes()
50
    {
51
        remove_post_type_support('page', 'comments');
52
        remove_post_type_support('page', 'custom-fields');
53
        remove_post_type_support('page', 'editor');
54
    }
55
}
56