You are here

class WebformName in RULES WEBFORM 3.x

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/WebformName.php \Drupal\rules_webform\Plugin\Condition\WebformName

Provides a 'Webform has ID' condition.

This condition will be added by default programmatically and will be hidden from the condition list.

Plugin annotation


@Condition(
  id = "webform_name",
  label = @Translation("Webform name"),
  category = @Translation("A Webform"),
  context_definitions = {
    "selected_webform_id" = @ContextDefinition("string",
      label = @Translation("Selected webform")
    ),
    "submitted_webform_info" = @ContextDefinition("webform_info",
      label = @Translation("Submitted webform info")
    )
  }
)

Hierarchy

  • class \Drupal\rules_webform\Plugin\Condition\WebformName extends \Drupal\rules\Core\RulesConditionBase

Expanded class hierarchy of WebformName

File

src/Plugin/Condition/WebformName.php, line 27

Namespace

Drupal\rules_webform\Plugin\Condition
View source
class WebformName extends RulesConditionBase {

  /**
   * Comparing id of selected and submitted webform.
   *
   * If the id of a selected webform (which was selected until a rule creation)
   * is the same as id of submitted webform then return TRUE.
   *
   * @param int $selected_webform_id
   *   Id of selected webform (which was selected until a rule creation).
   * @param array $submitted_webform_info
   *   Array with information about webform submission data (it contains id of
   *   the submitted webform).
   *
   * @return bool
   *   TRUE if id of the selected webform is the same as id of the submitted
   *   webform.
   */
  protected function doEvaluate($selected_webform_id, array $submitted_webform_info) {
    return $selected_webform_id == $submitted_webform_info['id'];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WebformName::doEvaluate protected function Comparing id of selected and submitted webform.