PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.3.1
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.3.1
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
insert-php / libs / factory / forms / includes / form-layout.class.php

form-layout.class.php in Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts 2.3.1, at libs/factory/forms/includes/form-layout.class.php

123 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The file contains the base class for all form layouts.
4 *
5 * @author Alex Kovalev <alex.kovalevv@gmail.com>
6 * @copyright (c) 2018, Webcraftic Ltd
7 *
8 * @package factory-forms
9 * @since 1.0.0
10 */
11
12 // Exit if accessed directly
13 if( !defined('ABSPATH') ) {
14 exit;
15 }
16
17 if( !class_exists('Wbcr_FactoryForms420_FormLayout') ) {
18
19 /**
20 * The base class for all form layouts.
21 */
22 abstract class Wbcr_FactoryForms420_FormLayout extends Wbcr_FactoryForms420_Holder {
23
24 /**
25 * A form layout name.
26 *
27 * @since 1.0.0
28 * @var string
29 */
30 protected $name = 'default';
31
32 /**
33 * A holder type.
34 *
35 * @since 1.0.0
36 * @var string
37 */
38 protected $type = 'form-layout';
39
40 /**
41 * Creates a new instance of a form layout.
42 *
43 * @since 1.0.0
44 * @param mixed[] $options A holder options.
45 * @param Wbcr_FactoryForms420_Form $form A parent form.
46 */
47 public function __construct($options, $form)
48 {
49
50 $options['name'] = $this->name;
51 $options['items'] = $form->getItems();
52
53 parent::__construct($options, $form);
54
55 $this->addCssClass('factory-forms-420-' . $this->type);
56 $this->addCssClass('factory-forms-420-' . $this->name);
57 }
58
59 /**
60 * Renders a beginning of a form.
61 *
62 * @since 1.0.0
63 * @return void
64 */
65 public function beforeRendering()
66 {
67 echo '<div ';
68 $this->attrs();
69 echo '>';
70 }
71
72 /**
73 * Renders the end of a form.
74 *
75 * @since 1.0.0
76 * @return void
77 */
78 public function afterRendering()
79 {
80 echo '</div>';
81 }
82
83 /**
84 * Rendering some html before a holder.
85 *
86 * @since 1.0.0
87 * @return void
88 */
89 public function beforeHolder($element)
90 {
91 }
92
93 /**
94 * Rendering some html after a holder.
95 *
96 * @since 1.0.0
97 * @return void
98 */
99 public function afterHolder($element)
100 {
101 }
102
103 /**
104 * Rendering some html before a contol.
105 *
106 * @since 1.0.0
107 * @return void
108 */
109 public function beforeControl($element)
110 {
111 }
112
113 /**
114 * Rendering some html after a contol.
115 *
116 * @since 1.0.0
117 * @return void
118 */
119 public function afterControl($element)
120 {
121 }
122 }
123 }