You are here

public function OembedProviderBucketForm::exist in oEmbed Providers 2.x

Helper function to check if oEmbed provider bucket config entity exists.

Parameters

string $id: A machine name.

Return value

bool Whether or not the machine name already exists.

File

src/OembedProviderBucketForm.php, line 169

Class

OembedProviderBucketForm
Form controller for the oEmbed provider bucket edit/add forms.

Namespace

Drupal\oembed_providers

Code

public function exist($id) {

  // The 'add' namespace is reserved.
  if ($id == 'add') {
    return TRUE;
  }
  $entity = $this->entityTypeManager
    ->getStorage('oembed_provider_bucket')
    ->getQuery()
    ->condition('id', $id)
    ->execute();
  return (bool) $entity;
}