You are here

function _webform_cards_form_state_has_cards in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_cards/webform_cards.module \_webform_cards_form_state_has_cards()

Determine if the form state's related webform has cards.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

bool TRUE if the form states entity webform has cards.

3 calls to _webform_cards_form_state_has_cards()
webform_cards_form_webform_settings_form_alter in modules/webform_cards/webform_cards.module
Implements hook_form_FORM_ID_alter() for webform settings:form.
webform_cards_form_webform_settings_form_form_alter in modules/webform_cards/webform_cards.module
Implements hook_form_FORM_ID_alter() for webform settings form.
webform_cards_form_webform_settings_submissions_form_alter in modules/webform_cards/webform_cards.module
Implements hook_form_FORM_ID_alter() for webform settings submissions.

File

modules/webform_cards/webform_cards.module, line 518
Provides a 'Card' container element for clientside multistep form pagination.

Code

function _webform_cards_form_state_has_cards(FormStateInterface $form_state) {

  /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
  $form_object = $form_state
    ->getFormObject();

  /** @var \Drupal\webform\WebformInterface $entity */
  $webform = $form_object
    ->getEntity();

  /** @var \Drupal\webform_cards\WebformCardsManagerInterface $webform_cards_manager */
  $webform_cards_manager = \Drupal::service('webform_cards.manager');

  // Check if the webform has cards.
  return $webform_cards_manager
    ->hasCards($webform);
}