You are here

public function CaptchaQuestionsSettingsForm::captchaQuestionsGetWebforms in Captcha Questions 8

Helper function to find webform form_ids.

Adapted from the function webform_mollom_form_list() in webform.module. Returns array keyed by webform form_ids and title, id of the webform.

2 calls to CaptchaQuestionsSettingsForm::captchaQuestionsGetWebforms()
CaptchaQuestionsSettingsForm::buildForm in src/Form/CaptchaQuestionsSettingsForm.php
Form constructor.
CaptchaQuestionsSettingsForm::captchaQuestionsGetFormIds in src/Form/CaptchaQuestionsSettingsForm.php
Helper function to make a list of candidates of form ids.

File

src/Form/CaptchaQuestionsSettingsForm.php, line 342

Class

CaptchaQuestionsSettingsForm
Displays the captcha_questions settings form.

Namespace

Drupal\captcha_questions\Form

Code

public function captchaQuestionsGetWebforms() {
  $forms = [];
  foreach (Webform::loadMultiple() as $webform_obj) {
    $form_id = 'webform_submission_' . $webform_obj
      ->id() . '_form';
    $forms[$form_id] = [
      'title' => $this
        ->t('@name form', [
        '@name' => $webform_obj
          ->label(),
      ]),
      'id' => $webform_obj
        ->id(),
    ];
  }
  return $forms;
}