You are here

public function EntityExtraField::exists in Entity Extra Field 8

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

Check if entity identifier exist.

Parameters

$name: The entity machine name.

Return value

int 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 338

Class

EntityExtraField
Define entity extra field.

Namespace

Drupal\entity_extra_field\Entity

Code

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