You are here

public function ExampleWebformVariant::isApplicable in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_example_variant/src/Plugin/WebformVariant/ExampleWebformVariant.php \Drupal\webform_example_variant\Plugin\WebformVariant\ExampleWebformVariant::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 ExampleWebformVariant::isApplicable()
ExampleWebformVariant::applyVariant in modules/webform_example_variant/src/Plugin/WebformVariant/ExampleWebformVariant.php
Apply variant to the webform.

File

modules/webform_example_variant/src/Plugin/WebformVariant/ExampleWebformVariant.php, line 35

Class

ExampleWebformVariant
Webform example variant.

Namespace

Drupal\webform_example_variant\Plugin\WebformVariant

Code

public function isApplicable(WebformInterface $webform) {

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