You are here

public function WebformVariantBase::applyVariant in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformVariantBase.php \Drupal\webform\Plugin\WebformVariantBase::applyVariant()

Apply variant to the webform.

Return value

bool TRUE if this variant was applied to the webform.

Overrides WebformVariantInterface::applyVariant

3 methods override WebformVariantBase::applyVariant()
ExampleWebformVariant::applyVariant in modules/webform_example_variant/src/Plugin/WebformVariant/ExampleWebformVariant.php
Apply variant to the webform.
OverrideWebformVariant::applyVariant in src/Plugin/WebformVariant/OverrideWebformVariant.php
Apply variant to the webform.
TestWebformVariant::applyVariant in tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformVariant.php
Apply variant to the webform.

File

src/Plugin/WebformVariantBase.php, line 366

Class

WebformVariantBase
Provides a base class for a webform variant.

Namespace

Drupal\webform\Plugin

Code

public function applyVariant() {
  $webform = $this
    ->getWebform();

  // Do not apply variant if it is not applicable to the webform.
  if (!$this
    ->isApplicable($webform)) {
    return FALSE;
  }

  // Apply variant here.
  return TRUE;
}