PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22.1
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/helpers/FrmHtmlHelper.php +25 -2 6.36.22.1 View file →
@@ -16,9 +16,11 @@
16 16 *
17 17 * @param string $id
18 18 * @param string $name
19 19 * @param array $args {
20 - * @param bool|null $echo True if you want the toggle to echo. False if you want it to return an HTML string.
20 + * Any extra arguments.
21 + *
22 + * @type bool|null $echo True if you want the toggle to echo. False if you want it to return an HTML string.
21 23 * }
22 24 *
23 25 * @return string|void
24 26 */
@@ -25,11 +27,32 @@
25 27 public static function toggle( $id, $name, $args ) {
26 28 wp_enqueue_script( 'formidable_settings' );
27 29 return FrmAppHelper::clip(
28 30 // @phpstan-ignore-next-line
29 - function() use ( $id, $name, $args ) {
31 + function () use ( $id, $name, $args ) {
30 32 require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php';
31 33 },
32 34 isset( $args['echo'] ) ? $args['echo'] : false
33 35 );
36 + }
37 +
38 + /**
39 + * Echo a dropdown option.
40 + * This is useful to avoid closing and opening PHP to echo <option> tags which leads to extra whitespace.
41 + * Avoiding whitespace saves 5KB of HTML for an international address field with a country dropdown with 252 options.
42 + *
43 + * @since 6.3.1
44 + *
45 + * @param string $option The string used as the option label.
46 + * @param bool $selected True if the option should be selected.
47 + * @param array $params Other HTML params for the option.
48 + * @return void
49 + */
50 + public static function echo_dropdown_option( $option, $selected, $params = array() ) {
51 + echo '<option ';
52 + FrmAppHelper::array_to_html_params( $params, true );
53 + selected( $selected );
54 + echo '>';
55 + echo esc_html( $option === '' ? ' ' : $option );
56 + echo '</option>';
34 57 }
35 58 }