public function OembedProviderForm::exist in oEmbed Providers 1.0.x
Same name and namespace in other branches
- 2.x src/OembedProviderForm.php \Drupal\oembed_providers\OembedProviderForm::exist()
- 1.1.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 398
Class
- OembedProviderForm
- Form controller for the oEmbed provider edit/add forms.
Namespace
Drupal\oembed_providersCode
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;
}