PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/factories/FrmFieldFactory.php +8 -12 6.26 → trunk View file →
@@ -25,9 +25,9 @@
25 25 $selector = apply_filters( 'frm_create_field_value_selector', $selector, $field_id, $args );
26 26 }
27 27
28 28 if ( ! is_object( $selector ) ) {
29 - $selector = new FrmFieldValueSelector( $field_id, $args );
29 + return new FrmFieldValueSelector( $field_id, $args );
30 30 }
31 31
32 32 return $selector;
33 33 }
@@ -41,9 +41,9 @@
41 41 */
42 42 public static function get_field_factory( $field ) {
43 43 if ( is_object( $field ) ) {
44 44 $field_info = self::get_field_object( $field );
45 - } elseif ( isset( $field['id'] ) && $field['id'] ) {
45 + } elseif ( ! empty( $field['id'] ) ) {
46 46 $field_info = self::get_field_object( $field['id'] );
47 47 } else {
48 48 $field_info = self::get_field_type( $field['type'], $field );
49 49 }
@@ -73,16 +73,9 @@
73 73 * @return FrmFieldType
74 74 */
75 75 public static function get_field_type( $field_type, $field = 0 ) {
76 76 $class = self::get_field_type_class( $field_type );
77 -
78 - if ( empty( $class ) ) {
79 - $field = new FrmFieldDefault( $field, $field_type );
80 - } else {
81 - $field = new $class( $field, $field_type );
82 - }
83 -
84 - return $field;
77 + return $class ? new $class( $field, $field_type ) : new FrmFieldDefault( $field, $field_type );
85 78 }
86 79
87 80 /**
88 81 * @since 3.0
@@ -108,11 +101,15 @@
108 101 'hidden' => 'FrmFieldHidden',
109 102 'captcha' => 'FrmFieldCaptcha',
110 103 'name' => 'FrmFieldName',
111 104 'credit_card' => 'FrmFieldCreditCard',
105 + 'address' => 'FrmFieldAddress',
112 106 // Submit button field.
113 107 FrmSubmitHelper::FIELD_TYPE => 'FrmFieldSubmit',
114 108 FrmFieldGdprHelper::FIELD_TYPE => FrmFieldGdprHelper::get_gdpr_field_class( $field_type ),
109 + 'product' => 'FrmFieldProduct',
110 + 'quantity' => 'FrmFieldQuantity',
111 + 'total' => 'FrmFieldTotal',
115 112 );
116 113
117 114 $class = $type_classes[ $field_type ] ?? '';
118 115
@@ -128,9 +125,9 @@
128 125 */
129 126 public static function field_has_html( $type ) {
130 127 $has_html = self::field_has_property( $type, 'has_html' );
131 128
132 - // this hook is here for reverse compatibility since 3.0
129 + // This hook is here for reverse compatibility since 3.0
133 130 return apply_filters( 'frm_show_custom_html', $has_html, $type );
134 131 }
135 132
136 133 /**
@@ -142,8 +139,7 @@
142 139 * @return mixed
143 140 */
144 141 public static function field_has_property( $type, $property ) {
145 142 $field = self::get_field_type( $type );
146 -
147 143 return $field->{$property};
148 144 }
149 145 }