You are here

public function OembedProviderForm::exist in oEmbed Providers 1.1.x

Same name and namespace in other branches
  1. 2.x src/OembedProviderForm.php \Drupal\oembed_providers\OembedProviderForm::exist()
  2. 1.0.x src/OembedProviderForm.php \Drupal\oembed_providers\OembedProviderForm::exist()

Helper function to check whether an oEmbed provider config entity exists.

Parameters

string $id: A machine name.

Return value

bool Whether or not the machine name already exists.

File

src/OembedProviderForm.php, line 412

Class

OembedProviderForm
Form controller for the oEmbed provider 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')
    ->getQuery()
    ->condition('id', $id)
    ->execute();
  return (bool) $entity;
}