You are here

public function EntityExtraField::exists in Entity Extra Field 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/EntityExtraField.php \Drupal\entity_extra_field\Entity\EntityExtraField::exists()

Check if entity identifier exist.

Parameters

string $name: The entity machine name.

Return value

bool Return TRUE if machine name exist; otherwise FALSE.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides EntityExtraFieldInterface::exists

File

src/Entity/EntityExtraField.php, line 417

Class

EntityExtraField
Define entity extra field.

Namespace

Drupal\entity_extra_field\Entity

Code

public function exists($name) : bool {
  return (bool) $this
    ->getQuery()
    ->condition('id', "{$this->getBaseEntityTypeId()}.{$this->getBaseBundleTypeId()}.{$name}")
    ->execute();
}