You are here

protected function PageVariantAddForm::variantExists in Page Manager 8

Same name and namespace in other branches
  1. 8.4 page_manager_ui/src/Form/PageVariantAddForm.php \Drupal\page_manager_ui\Form\PageVariantAddForm::variantExists()

Check if a variant id is taken.

Parameters

\Drupal\page_manager\PageInterface $page: The page entity.

string $variant_id: The page variant id to check.

Return value

bool TRUE if the ID is available; FALSE otherwise.

1 call to PageVariantAddForm::variantExists()
PageVariantAddForm::submitForm in page_manager_ui/src/Form/PageVariantAddForm.php
Form submission handler.

File

page_manager_ui/src/Form/PageVariantAddForm.php, line 117
Contains Drupal\page_manager_ui\Form\PageVariantAddForm.

Class

PageVariantAddForm
Provides a form for adding a variant.

Namespace

Drupal\page_manager_ui\Form

Code

protected function variantExists(PageInterface $page, $variant_id) {
  return isset($page
    ->getVariants()[$variant_id]) || PageVariant::load($variant_id);
}