You are here

function rules_webform_help in RULES WEBFORM 8

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

Implements hook_help().

File

./rules_webform.module, line 423
Contains rules_webform.module.

Code

function rules_webform_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the rules_webform module.
    case 'help.page.rules_webform':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>';
      $output .= t("The 'Rules Webform' module provides integration of 'Rules' and 'Webform' modules.") . ' ';
      $output .= t('It enables site builders and administrators to get access to webform submission data from rules.');
      $output .= ' ';
      $output .= t('Also it provides possibility of altering and removing webform submissions from rules.');
      $output .= '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<h4>' . t('Read a webform submission') . '</h4>';
      $output .= t('To access webform submission data from a rule you need to do two things:');
      $output .= '<ol>';
      $output .= '<li>' . t("Select the 'Webform submit' event from the 'React on event' listbox.") . '</li>';
      $output .= '<li>' . t("Select  necessary webform from the 'Webform' listbox that will appear below.") . '</li>';
      $output .= '</ol>';
      $output .= '<p>';
      $output .= t("After that will be available two new variables: 'webform_fields' and 'webform_info'.") . ' ';
      $output .= t('You can use them in your rule actions and conditions.') . ' ' . '<br/>';
      $output .= t("'webform_fields' contains values of webform fields and 'webform_info' contains") . ' ';
      $output .= t('additional information like submission date, author and so on.');
      $output .= '</p>';
      $output .= '<p>';
      $output .= t("To investigate them it's conveniently to use 'Data selection mode'.") . ' ';
      $output .= t("Therefore click on 'Switch to data selection mode' button in your condition or action page.") . ' ';
      $output .= t("Then type variable name with dot at the end, like this: 'webform_fields.'") . ' ';
      $output .= t('After that you will see all webform fields and you can choose any of them.') . ' ';
      $output .= t("But you can also use 'Direct input mode'.") . ' ';
      $output .= t("For instance, if you need to get the value of 'message' field you can use Twig syntax like this:");
      $output .= ' ';
      $output .= '{{&nbsp; webform_fields.message &nbsp;}}';
      $output .= '</p>';
      $output .= '<h4>' . t('Alter a webform submission') . '</h4>';
      $output .= '<p>';
      $output .= t("To alter a webform field value you need to do the following:");
      $output .= '</p>';
      $output .= '<p>';
      $output .= t("1. Add 'Set webform field value' action.");
      $output .= '</p>';
      $output .= '<p>';
      $output .= t('2. Select a webform field you want to alter.');
      $output .= '</br>';
      $output .= t("Keep in mind that it's possible to select a webform field only in 'Data selection' mode.");
      $output .= ' ';
      $output .= t("Therefore click on 'Switch to data selection' button before you start typing.");
      $output .= ' ';
      $output .= t('Then type the name of a necessary webfrom field.');
      $output .= ' ';
      $output .= t("For instance, if you want to alter the value of 'message' field, type the following:");
      $output .= '</br>';
      $output .= ' webform_fields.message';
      $output .= '<p>';
      $output .= t("3. Input a new value of webform field into the 'VALUE' field.");
      $output .= '</br>';
      $output .= t('Remember that you can completely replace field value as well as to complement existing value.');
      $output .= ' ';
      $output .= t("Let's say you want to complement the value of field 'name' with 'Sir'.");
      $output .= ' ';
      $output .= t("Then stay in the 'Direct input' mode and type the following:");
      $output .= '</br>';
      $output .= 'Sir {{ webform_field.name }}';
      $output .= '</p>';
      $output .= '<h4>' . t('Delete a webform submission') . '</h4>';
      $output .= '<p>';
      $output .= t("To delete a webform submission from a rule use 'Delete webform submission' action.");
      $output .= '</p>';
      $output .= '<h3>' . t('Known issues') . '</h3>';
      $output .= '<p>';
      $output .= t("Before adding 'Delete webform submission' action ensure that you save previous changes of your rule");
      $output .= ' (';
      $output .= t("click on 'Save' button");
      $output .= ').';
      $output .= '</p>';
      return $output;
  }
}