PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.3.0
JetFormBuilder — Dynamic Blocks Form Builder v1.3.0
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.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.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / classes / attributes-trait.php
jetformbuilder / includes / classes Last commit date
attributes-trait.php 4 years ago builder-helper.php 4 years ago condition-helper.php 4 years ago curl-helper.php 4 years ago factory.php 4 years ago gallery.php 4 years ago get-icon-trait.php 4 years ago get-template-trait.php 4 years ago instance-trait.php 4 years ago listing-filter-manager.php 4 years ago listing-filter.php 4 years ago messages-helper-trait.php 4 years ago tools.php 4 years ago
attributes-trait.php
82 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Classes;
5
6
7 use Jet_Form_Builder\Blocks\Render\Base;
8
9 trait Attributes_Trait {
10 public $attrs = array();
11
12 /**
13 * Add attribute
14 *
15 * @param $attr
16 * @param null $value
17 */
18 public function add_attribute( $attr, $value = null ) {
19
20 if ( '' === $value ) {
21 return;
22 }
23 if ( ! isset( $this->attrs[ $attr ] ) ) {
24 $this->attrs[ $attr ] = $value;
25 } else {
26 $this->attrs[ $attr ] .= ' ' . $value;
27 }
28
29 }
30
31 /**
32 * Reset attributes array
33 */
34 public function reset_attributes() {
35 $this->attrs = array();
36 }
37
38 /**
39 * Render current attributes string
40 *
41 * @return void
42 */
43 public function render_attributes_string() {
44 $this->render_attributes_string_save();
45 $this->attrs = array();
46 }
47
48 public function render_attributes_string_save() {
49 echo $this->get_attributes_string_save();
50 }
51
52 public function get_attributes_string_save() {
53 $response = '';
54 $attrs = $this->attrs;
55
56 if ( $this instanceof Base ) {
57 $attrs = apply_filters(
58 "jet-form-builder/render/{$this->get_name()}/attributes",
59 $attrs,
60 $this
61 );
62 }
63
64 foreach ( $attrs as $attr => $value ) {
65 if ( is_array( $value ) ) {
66 $value = implode( ' ', $value );
67 }
68 $response .= sprintf( ' %1$s="%2$s"', $attr, $value );
69 }
70
71 return $response;
72 }
73
74 public function get_attributes_string() {
75 $response = $this->get_attributes_string_save();
76 $this->attrs = array();
77
78 return $response;
79 }
80
81
82 }