Completed
Pull Request — master (#2)
by Beñat
02:35
created

General::screenOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace LIN3S\WPSymfonyForm\Admin\Views;
4
5
use LIN3S\WPSymfonyForm\Admin\Views\Components\FormsTable;
6
7
/**
8
 * General page.
9
 *
10
 * @author Beñat Espiña <[email protected]>
11
 */
12
class General implements Page
13
{
14
    /**
15
     * The forms table component.
16
     *
17
     * @var FormsTable
18
     */
19
    private $formsTable;
20
21
    /**
22
     * Constructor.
23
     *
24
     * @param FormsTable $formsTable The logs table component
25
     */
26
    public function __construct(FormsTable $formsTable)
27
    {
28
        $this->formsTable = $formsTable;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function display()
35
    {
36
        $wpFormTable = $this->formsTable->load();
37
        $wpFormTable->prepare_items(); ?>
38
        <div class="wrap">
39
            <h2><?php _e('General', \WPSymfonyForm::TRANSLATION_DOMAIN); ?></h2>
40
            <div id="poststuff">
41
                <div id="post-body" class="metabox-holder">
42
                    <div id="post-body-content">
43
                        <?php $wpFormTable->display(); ?>
44
                    </div>
45
                </div>
46
                <br class="clear">
47
            </div>
48
        </div>
49
        <?php
50
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function screenOptions()
57
    {
58
        add_screen_option('per_page', [
59
            'label'   => 'Forms',
60
            'default' => 10,
61
            'option'  => 'forms_per_page',
62
        ]);
63
    }
64
}
65