Completed
Push — master ( 261499...3196a9 )
by Beñat
07:26
created

CustomPostTypeFields::removeScreenAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
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;
13
14
/**
15
 * Abstract custom post type fields class that extends the fields basic
16
 * behaviour, implementing the "connector" and "removeScreenAttributes"
17
 * methods with the common use case.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
abstract class CustomPostTypeFields extends Fields
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function connector()
27
    {
28
        return [
29
            [
30
                [
31
                    'param'    => 'post_type',
32
                    'operator' => '==',
33
                    'value'    => $this->name,
34
                ],
35
            ],
36
        ];
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function removeScreenAttributes()
43
    {
44
        remove_post_type_support('page', 'comments');
45
        remove_post_type_support('page', 'custom-fields');
46
    }
47
}
48