You are here

public function WorkspaceForm::exists in Workspace 8

Determines if a workspace with the specified machine name already exists.

Parameters

string $machine_name:

Return value

bool TRUE if the machine_name exists, FALSE otherwise.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/Entity/Form/WorkspaceForm.php, line 267

Class

WorkspaceForm
Form controller for the workspace edit forms.

Namespace

Drupal\workspace\Entity\Form

Code

public function exists($machine_name) {
  return (bool) $this->entityTypeManager
    ->getStorage('workspace')
    ->getQuery()
    ->condition('machine_name', $machine_name)
    ->execute();
}