You are here

function rules_webform_store_webform_id in RULES WEBFORM 8

Same name and namespace in other branches
  1. 3.x rules_webform.module \rules_webform_store_webform_id()

Add the 'webform_fields' properties definitions to the context variable.

1 call to rules_webform_store_webform_id()
rules_webform_check_if_webform_submit_event_selected in ./rules_webform.module
Check if Webform events selected.

File

./rules_webform.module, line 81
Contains rules_webform.module.

Code

function rules_webform_store_webform_id($form, FormStateInterface $form_state) {
  $webform_id = $form_state
    ->getValue('webform_id');
  if (!empty($webform_id)) {
    $reaction_rule = $form_state
      ->getFormObject()
      ->getEntity();

    // Store webform id, it will be then using in the following hook:
    // 'rules_webform_form_rules_reaction_rule_edit_form_alter()'.
    // For storing we use state instead of setThirdPartySetting().
    // It enables reinstall the module and continue to using rules
    // that use this module.
    $rule_id = $reaction_rule->id;
    \Drupal::state()
      ->set('rules_webform.webform_id.' . $rule_id, $webform_id);
    \Drupal::state()
      ->get('rules_webform.webform_id.' . $rule_id);
  }
}