Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
26.32% covered (danger)
26.32%
5 / 19
33.33% covered (danger)
33.33%
1 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Content
26.32% covered (danger)
26.32%
5 / 19
33.33% covered (danger)
33.33%
1 / 3
6.60
0.00% covered (danger)
0.00%
0 / 1
 init
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 addSettingsSection
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
 sectionCallback
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Settings > BeyondWords > Content
7 *
8 * @package Beyondwords\Wordpress
9 * @author  Stuart McAlpine <stu@beyondwords.io>
10 * @since   5.0.0
11 */
12
13namespace Beyondwords\Wordpress\Component\Settings\Tabs\Content;
14
15use Beyondwords\Wordpress\Component\Settings\Fields\AutoPublish\AutoPublish;
16use Beyondwords\Wordpress\Component\Settings\Fields\IncludeExcerpt\IncludeExcerpt;
17use Beyondwords\Wordpress\Component\Settings\Fields\IncludeTitle\IncludeTitle;
18use Beyondwords\Wordpress\Component\Settings\Fields\PreselectGenerateAudio\PreselectGenerateAudio;
19
20/**
21 * "Content" settings tab
22 *
23 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
24 *
25 * @since 5.0.0
26 */
27class Content
28{
29    /**
30     * Init
31     *
32     * @since 5.0.0
33     */
34    public function init()
35    {
36        (new IncludeTitle())->init();
37        (new AutoPublish())->init();
38        (new IncludeExcerpt())->init();
39        (new PreselectGenerateAudio())->init();
40
41        add_action('admin_init', array($this, 'addSettingsSection'), 5);
42    }
43
44    /**
45     * Add Settings sections.
46     *
47     * @since 5.0.0
48     */
49    public function addSettingsSection()
50    {
51        add_settings_section(
52            'content',
53            __('Content', 'speechkit'),
54            array($this, 'sectionCallback'),
55            'beyondwords_content',
56        );
57    }
58
59    /**
60     * Section callback
61     *
62     * @since 5.0.0
63     *
64     * @return void
65     **/
66    public function sectionCallback()
67    {
68        ?>
69        <p class="description">
70            <?php
71            esc_html_e(
72                'Only future content will be affected. To apply changes to existing content, please regenerate each post.', // phpcs:ignore Generic.Files.LineLength.TooLong
73                'speechkit'
74            );
75            ?>
76        </p>
77        <?php
78    }
79}