You are here

public function RulesComponentFormBase::exists in Rules 8.3

Machine name exists callback.

Parameters

string $id: The machine name ID.

Return value

bool TRUE if an entity with the same name already exists, FALSE otherwise.

File

src/Form/RulesComponentFormBase.php, line 124

Class

RulesComponentFormBase
Provides the base form for rules add and edit forms.

Namespace

Drupal\rules\Form

Code

public function exists($id) {
  $type = $this->entity
    ->getEntityTypeId();
  return (bool) $this->entityTypeManager
    ->getStorage($type)
    ->load($id);
}