Commit c2ef826f authored by Ryan McVeigh's avatar Ryan McVeigh
Browse files

Issue #3272071 by rymcveigh: Breaking error on webforms that do not use forward navigation

parent b2e9dfb4
Loading
Loading
Loading
Loading
+45 −34
Original line number Diff line number Diff line
@@ -60,7 +60,12 @@ function webformnavigation_theme() {
function webformnavigation_preprocess_webform_progress_tracker(&$variables) {
  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = $variables['webform'];
  /** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
  $webform_submission = $variables['webform_submission'];
  // Get navigation webform settings.
  $forward_navigation = $webform->getThirdPartySetting('webformnavigation', 'forward_navigation');
  // Set default forward navigation settings.
  if ($forward_navigation && !empty($webform_submission)) {
    $pages = $webform->getPages($variables['operation'], $webform_submission);
    // Get the logged errors for the form.
    /** @var \Drupal\webformnavigation\WebformNavigationHelper $webformnavigation_helper */
@@ -81,6 +86,7 @@ function webformnavigation_preprocess_webform_progress_tracker(&$variables) {
      }
    }
  }
}

/**
 * Implements hook_preprocess_HOOK().
@@ -90,6 +96,10 @@ function webformnavigation_preprocess_webform_progress_bar(&$variables) {
  $webform = $variables['webform'];
  /** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
  $webform_submission = $variables['webform_submission'];
  // Get navigation webform settings.
  $forward_navigation = $webform->getThirdPartySetting('webformnavigation', 'forward_navigation');
  // Set default forward navigation settings.
  if ($forward_navigation && !empty($webform_submission)) {
    $pages = $webform->getPages($variables['operation'], $webform_submission);
    // Get the logged errors for the form.
    /** @var \Drupal\webformnavigation\WebformNavigationHelper $webformnavigation_helper */
@@ -110,6 +120,7 @@ function webformnavigation_preprocess_webform_progress_bar(&$variables) {
      }
    }
  }
}

/**
 * Implements hook_webform_third_party_settings_form_alter().