# speechkit/6.3.0/src/Component/Settings/Fields/ProjectId/ProjectId.php

BeyondWords – AI audio for publishers, version 6.3.0. 120 lines.

- Page: https://pluginprobe.com/plugins/speechkit/6.3.0/code/src/Component/Settings/Fields/ProjectId/ProjectId.php
- Raw: https://pluginprobe.com/plugins/speechkit/6.3.0/raw/src/Component/Settings/Fields/ProjectId/ProjectId.php
- Modified: 2026-04-12T21:25:20+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/6.3.0/code/src/Component/Settings/Fields/ProjectId/ProjectId.php#L10-L20`.

```php
<?php

declare(strict_types=1);

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

namespace Beyondwords\Wordpress\Component\Settings\Fields\ProjectId;

use Beyondwords\Wordpress\Component\Settings\SettingsUtils;

/**
 * ProjectId
 *
 * @since 3.0.0
 */
defined('ABSPATH') || exit;

class ProjectId
{
    /**
     * Option name.
     *
     * @since 5.0.0
     */
    public const OPTION_NAME = 'beyondwords_project_id';

    /**
     * Init.
     *
     * @since 4.0.0
     * @since 6.0.0 Make static.
     */
    public static function init()
    {
        add_action('admin_init', [self::class, 'addSetting']);
    }

    /**
     * Init setting.
     *
     * @since 3.0.0
     * @since 6.0.0 Make static.
     *
     * @return void
     */
    public static function addSetting()
    {
        register_setting(
            'beyondwords_credentials_settings',
            self::OPTION_NAME,
            [
                'default'           => '',
                'sanitize_callback' => [self::class, 'sanitize'],
            ]
        );

        add_settings_field(
            'beyondwords-project-id',
            __('Project ID', 'speechkit'),
            [self::class, 'render'],
            'beyondwords_credentials',
            'credentials'
        );
    }

    /**
     * Render setting field.
     *
     * @since 3.0.0
     * @since 6.0.0 Make static.
     *
     * @return void
     **/
    public static function render()
    {
        $value = get_option(self::OPTION_NAME);
        ?>
        <input
            type="text"
            id="<?php echo esc_attr(self::OPTION_NAME); ?>"
            name="<?php echo esc_attr(self::OPTION_NAME); ?>"
            value="<?php echo esc_attr($value); ?>"
            size="10"
        />
        <?php
    }

    /**
     * Sanitise the setting value.
     *
     * @since 3.0.0
     * @since 5.2.0 Remove creds validation from here.
     * @since 6.0.0 Make static.
     *
     * @param array $value The submitted value.
     *
     * @return void
     **/
    public static function sanitize($value)
    {
        if (empty($value)) {
            SettingsUtils::addSettingsErrorMessage(
                __(
                    'Please enter your BeyondWords project ID. This can be found in your project settings.',
                    'speechkit'
                ),
                'Settings/ProjectId'
            );
        }

        return $value;
    }
}

```
