# speechkit/4.0.0/src/Component/Settings/PrependExcerpt/PrependExcerpt.php

BeyondWords – AI audio for publishers, version 4.0.0. 96 lines.

- Page: https://pluginprobe.com/plugins/speechkit/4.0.0/code/src/Component/Settings/PrependExcerpt/PrependExcerpt.php
- Raw: https://pluginprobe.com/plugins/speechkit/4.0.0/raw/src/Component/Settings/PrependExcerpt/PrependExcerpt.php
- Modified: 2023-07-26T14:25:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/speechkit/4.0.0/code/src/Component/Settings/PrependExcerpt/PrependExcerpt.php#L10-L20`.

```php
<?php

declare(strict_types=1);

/**
 * Setting: Process excerpts
 *
 * @package Beyondwords\Wordpress
 * @author  Stuart McAlpine <stu@beyondwords.io>
 * @since   3.0.0
 */

namespace Beyondwords\Wordpress\Component\Settings\PrependExcerpt;

use Beyondwords\Wordpress\Component\Settings\SettingsUtils;

/**
 * PrependExcerpt setup
 *
 * @since 3.0.0
 */
class PrependExcerpt
{
    /**
     * Constructor
     */
    public function __construct()
    {
        add_action('admin_init', array($this, 'init'));
    }

    /**
     * Init setting.
     *
     * @since  3.0.0
     *
     * @return void
     */
    public function init()
    {
        if (! SettingsUtils::hasApiSettings()) {
            return;
        }

        register_setting(
            'beyondwords',
            'beyondwords_prepend_excerpt',
            [
                'default' => '',
            ]
        );

        add_settings_field(
            'beyondwords-prepend-excerpt',
            __('Process excerpts', 'speechkit'),
            array($this, 'render'),
            'beyondwords',
            'content'
        );
    }

    /**
     * Render setting field.
     *
     * @since 3.0.0
     * @since 4.0.0 Updated label and description
     *
     * @return void
     **/
    public function render()
    {
        $prependExcerpt = get_option('beyondwords_prepend_excerpt', '');
        ?>
        <div>
            <label>
                <input
                    type="checkbox"
                    name="beyondwords_prepend_excerpt"
                    value="1"
                    <?php checked($prependExcerpt, '1'); ?>
                />
                <?php _e('Use excerpts for summaries', 'speechkit'); ?>
            </label>
        </div>
        <p class="description">
            <?php
            _e(
                'Summaries are read aloud in-between titles and body content.',
                'speechkit'
            );
            ?>
        </p>
        <?php
    }
}

```
