Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Content
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 init
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 addSettingsSection
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 sectionCallback
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
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\IntegrationMethod\IntegrationMethod;
19use Beyondwords\Wordpress\Component\Settings\Fields\PreselectGenerateAudio\PreselectGenerateAudio;
20
21/**
22 * "Content" settings tab
23 * @since 5.0.0
24 */
25defined('ABSPATH') || exit;
26
27class Content
28{
29    /**
30     * Init
31     *
32     * @since 5.0.0 Introduced.
33     * @since 6.0.0 Make static and add IntegrationMethod.
34     */
35    public static function init()
36    {
37        (new IntegrationMethod())::init();
38        (new IncludeTitle())::init();
39        (new AutoPublish())::init();
40        (new IncludeExcerpt())::init();
41        (new PreselectGenerateAudio())::init();
42
43        add_action('admin_init', [self::class, 'addSettingsSection'], 5);
44    }
45
46    /**
47     * Add Settings sections.
48     *
49     * @since 5.0.0
50     * @since 6.0.0 Make static.
51     */
52    public static function addSettingsSection()
53    {
54        add_settings_section(
55            'content',
56            __('Content', 'speechkit'),
57            [self::class, 'sectionCallback'],
58            'beyondwords_content',
59        );
60    }
61
62    /**
63     * Section callback
64     *
65     * @since 5.0.0
66     * @since 6.0.0 Make static.
67     *
68     * @return void
69     **/
70    public static function sectionCallback()
71    {
72        ?>
73        <p class="description">
74            <?php
75            esc_html_e(
76                'Only future content will be affected. To apply changes to existing content, please regenerate each post.', // phpcs:ignore Generic.Files.LineLength.TooLong
77                'speechkit'
78            );
79            ?>
80        </p>
81        <?php
82    }
83}