PluginProbe
Sendy / 3.4.5
Sendy v3.4.5
3.4.6 3.4.7 trunk 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 All 32 releases
sendy / lib / Modules / Admin / Fields / Field.php

Field.php in Sendy 3.4.5, at lib/Modules/Admin/Fields/Field.php

43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sendy\WooCommerce\Modules\Admin\Fields;
4
5 use Sendy\WooCommerce\Utils\View;
6
7 abstract class Field
8 {
9 protected string $optionName;
10 protected ?string $extraDescription;
11
12 protected View $view;
13
14 public function __construct(
15 string $optionName,
16 string $extraDescription = null
17 ) {
18 $this->optionName = $optionName;
19 $this->extraDescription = $extraDescription;
20 }
21
22 /**
23 * Initialize the view which is used to render the field
24 *
25 * This method is called from the render method when rendering the view. Therefor it's only necessary to implement
26 * this method on the child classes without calling it.
27 */
28 abstract public function initializeView(): void;
29
30 final public function render(array $parameters = []): void
31 {
32 $this->initializeView();
33
34 echo wp_kses(
35 $this->view->render(array_merge($parameters, [
36 'option_name' => $this->optionName,
37 'extra_description' => $this->extraDescription,
38 ])),
39 View::ALLOWED_TAGS,
40 );
41 }
42 }
43