# sendy/3.0.3/src/Modules/Admin/Fields/Field.php

Sendy, version 3.0.3. 46 lines.

- Page: https://pluginprobe.com/plugins/sendy/3.0.3/code/src/Modules/Admin/Fields/Field.php
- Raw: https://pluginprobe.com/plugins/sendy/3.0.3/raw/src/Modules/Admin/Fields/Field.php
- Modified: 2024-12-02T11:23:28+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/sendy/3.0.3/code/src/Modules/Admin/Fields/Field.php#L10-L20`.

```php
<?php

namespace Sendy\WooCommerce\Modules\Admin\Fields;

use Sendy\WooCommerce\Utils\View;

abstract class Field
{
    protected string $optionName;
    protected ?string $extraDescription;

    protected View $view;

    public function __construct(
        string $optionName,
        string $extraDescription = null
    )
    {
        $this->optionName = $optionName;
        $this->extraDescription = $extraDescription;
    }

    /**
     * Initialize the view which is used to render the field
     *
     * This method is called from the render method when rendering the view. Therefor it's only necessary to implement
     * this method on the child classes without calling it.
     *
     * @return void
     */
    abstract function initializeView(): void;

    final public function render(array $parameters = []): void
    {
        $this->initializeView();

        echo wp_kses(
            $this->view->render(array_merge($parameters, [
                'option_name' => $this->optionName,
                'extra_description' => $this->extraDescription,
            ])),
            View::ALLOWED_TAGS
        );
    }
}

```
