You are here

public function TestWebformVariant::isApplicable in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformVariant.php \Drupal\webform_test_variant\Plugin\WebformVariant\TestWebformVariant::isApplicable()

Determine if this variant is applicable to the webform.

Parameters

\Drupal\webform\WebformInterface $webform: A webform.

Return value

bool TRUE if this variant is applicable to the webform.

Overrides WebformVariantBase::isApplicable

1 call to TestWebformVariant::isApplicable()
TestWebformVariant::applyVariant in tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformVariant.php
Apply variant to the webform.

File

tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformVariant.php, line 34

Class

TestWebformVariant
Webform example variant.

Namespace

Drupal\webform_test_variant\Plugin\WebformVariant

Code

public function isApplicable(WebformInterface $webform) {

  // Only allow variant to be applicable to webform_test_variant_ webforms.
  return strpos($webform
    ->id(), 'test_variant_') === 0 || strpos($webform
    ->id(), 'example_variant_') === 0;
}