You are here

public function WebformVariantFormBase::exists in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformVariantFormBase.php \Drupal\webform\Form\WebformVariantFormBase::exists()

Determines if the webform variant ID already exists.

Parameters

string $variant_id: The webform variant ID.

Return value

bool TRUE if the webform variant ID exists, FALSE otherwise.

File

src/Form/WebformVariantFormBase.php, line 316

Class

WebformVariantFormBase
Provides a base webform for webform variants.

Namespace

Drupal\webform\Form

Code

public function exists($variant_id) {
  $instance_ids = $this->webform
    ->getVariants()
    ->getInstanceIds();
  return isset($instance_ids[$variant_id]) ? TRUE : FALSE;
}