You are here

public function FacConfigForm::exists in Fast Autocomplete 8

Checks if the given id exists.

Parameters

string $id: The id to check.

Return value

bool FALSE if the id does not exist yet. TRUE otherwise.

File

src/Form/FacConfigForm.php, line 384

Class

FacConfigForm
Class FacConfigForm.

Namespace

Drupal\fac\Form

Code

public function exists($id) {
  try {
    $entity = $this->entityTypeManager
      ->getStorage('fac_config')
      ->getQuery()
      ->condition('id', $id)
      ->execute();
    return (bool) $entity;
  } catch (InvalidPluginDefinitionException $e) {
    return FALSE;
  }
}