From b30c8832972b6cf412cc26490591536008c6baf9 Mon Sep 17 00:00:00 2001 From: Tony Blacker Date: Wed, 25 Sep 2019 21:37:58 +0100 Subject: [PATCH 1/2] Gravbity Forms fixes Removed remote jQuery call Updated gravity-forms inc file to reflect nhsuk theme Added styling to style_variations.scss --- assets/scss/style_variations.scss | 31 +++ inc/gravity-forms.php | 311 ++++++++++++++---------------- inc/performance-optimisations.php | 9 - style-gutenburg.css | 29 +++ style.css | 29 +++ 5 files changed, 236 insertions(+), 173 deletions(-) diff --git a/assets/scss/style_variations.scss b/assets/scss/style_variations.scss index 4995f45e..3e4f3ff1 100644 --- a/assets/scss/style_variations.scss +++ b/assets/scss/style_variations.scss @@ -144,3 +144,34 @@ .nhsuk-grid-column-width, .nhsuk-grid-column-full { clear: both; } + +//Gravity forms gumpfh +.gform_heading { + .gform_description { + font-size: 1rem; + font-weight: 700; + } +} +.gform_body { + padding-top: 30px; + + ul.gform_fields { + list-style: none; + margin-left: 0; + padding-left: 0; + + .nhsuk-required-message { + font-weight: bold; + font-style: italic; + padding-left: 20px; + } + + .nhsuk-textarea { + min-height: 200px; + } + + .gform_hidden { + display: none; + } + } +} diff --git a/inc/gravity-forms.php b/inc/gravity-forms.php index d1a511bf..f86ebbf0 100644 --- a/inc/gravity-forms.php +++ b/inc/gravity-forms.php @@ -1,168 +1,151 @@ elements. - $form_string = preg_replace( "#(.*?)#", '$1', $form_string ); - - // Style error messages. - // Message at top of form. - $form_string = str_replace( 'validation_error', 'c-form-input is-error validation_error', $form_string ); - // Fields with CSS class = "gfield_error". - $form_string = str_replace( 'gfield_error', 'is-error gfield_error', $form_string ); - // Fields contained in
  • elements that have CSS class = "gfield_error". - $form_string = preg_replace( "#. - $form_string = str_replace( "class='gform_fields", "class='c-form-list gform_fields", $form_string ); - - // Replace

    with

    . - $form_string = str_replace( '', '/h2>', $form_string ); - - // Replace field description divs with elements. - $form_string = preg_replace( "#
    (.*?)
    #", '$1', $form_string ); - - // Replace field instruction divs with elements. - $form_string = preg_replace( "#
    $2', $form_string ); - - // Indicate mandatory fields with "Required" rather than "*". - $form_string = str_replace( "*", " (Required)", $form_string ); - - // Replace main