You are here

public function ThemeSwitcherRuleForm::exist in Theme Switcher Rules 8

Checks whether a theme_switcher_rule exists.

Parameters

string $id: The theme_switcher_rule machine name.

Return value

bool Whether the theme_switcher_rule exists.

File

src/Form/ThemeSwitcherRuleForm.php, line 283

Class

ThemeSwitcherRuleForm
Form handler for the ThemeSwitcherRule add and edit forms.

Namespace

Drupal\theme_switcher\Form

Code

public function exist($id) {
  $entity = $this->entityTypeManager
    ->getStorage('theme_switcher_rule')
    ->getQuery()
    ->condition('id', $id)
    ->execute();
  return (bool) $entity;
}