PluginProbe
Sendy / 3.0.3
Sendy v3.0.3
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 / src / Modules / Admin / Fields / Field.php

Field.php in Sendy 3.0.3, at src/Modules/Admin/Fields/Field.php

46 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 {
19 $this->optionName = $optionName;
20 $this->extraDescription = $extraDescription;
21 }
22
23 /**
24 * Initialize the view which is used to render the field
25 *
26 * This method is called from the render method when rendering the view. Therefor it's only necessary to implement
27 * this method on the child classes without calling it.
28 *
29 * @return void
30 */
31 abstract function initializeView(): void;
32
33 final public function render(array $parameters = []): void
34 {
35 $this->initializeView();
36
37 echo wp_kses(
38 $this->view->render(array_merge($parameters, [
39 'option_name' => $this->optionName,
40 'extra_description' => $this->extraDescription,
41 ])),
42 View::ALLOWED_TAGS
43 );
44 }
45 }
46