diff --git a/CHANGELOG.md b/CHANGELOG.md index 236ff77..3b9dc3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ * Navbar: Disable show on goingup on WooCommerce Checkout and when page content has a form (Gravity Forms or not) +* Gravity Forms: refactoring, and disable JS in footer since it is now default to true in the plugin ### 0.8.5: October 28th, 2021 * Images: align center even with webp images (picture, figure tags) diff --git a/inc/plugins/gravityforms.php b/inc/plugins/gravityforms.php index 238e24c..95f30b5 100644 --- a/inc/plugins/gravityforms.php +++ b/inc/plugins/gravityforms.php @@ -1,30 +1,22 @@ '; - $message .= '×'; - $message .= '' . $oldmessage . ''; - $message .= ''; - return $message; -} -add_filter('gform_validation_message', 'stormbringer_gform_validation_message', 10, 2); - -*/ -// This filter is used to enable the inclusion of the hidden choice in the Field Label Visibility and Sub-Label Placement settings on the field Appearance tab in the form editor. +// Gravity Forms: enable the inclusion of the hidden choice in the Field Label Visibility and Sub-Label Placement settings on the field Appearance tab in the form editor. add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' ); - -// This filter can be used to dynamically add/remove CSS classes to a field -function stormbringer_gform_field_css_class($classes, $field, $form) +/** + * Gravity Forms: field css classes + * + * @param string $classes + * @param $field + * @param $form + * + * @return array|string|string[] + */ +function stormbringer_gform_field_css_class(string $classes, $field, $form) { $form_css = $form['cssClass'] ?? ''; @@ -35,7 +27,7 @@ function stormbringer_gform_field_css_class($classes, $field, $form) $classes = str_replace('icon-', 'dummy-', $classes); //$classes = str_replace('gfield', 'form-group gfield', $classes); - if ($field["type"] == 'textarea' || $field["type"] == 'text' || $field["type"] == 'email' || $field["type"] == 'name') { + if ($field['type'] == 'textarea' || $field['type'] == 'text' || $field['type'] == 'email' || $field['type'] == 'name') { if (strpos($form_css, 'form-placeholder') !== false) $classes .= " hide-label"; @@ -52,7 +44,7 @@ function stormbringer_gform_field_css_class($classes, $field, $form) add_action('gform_field_css_class', 'stormbringer_gform_field_css_class', 10, 3); /** - * Gravity Forms Submit Button + * Gravity Forms: submit Button * * @param $button * @param $form @@ -69,23 +61,40 @@ function stormbringer_gform_submit_button($button, $form) } add_filter('gform_submit_button', 'stormbringer_gform_submit_button', 10, 2); -function stormbringer_gform_next_button($button, $form) -{ +/** + * Gravity Forms: next button + * + * @param $button + * @param $form + * + * @return string + */ +function stormbringer_gform_next_button($button, $form): string { return '