public function ColorForm::checkMachineName in Color API 8
Helper function to check whether the Color machine_name already exists.
Parameters
string $id: The Entity machine name to check for existence.
Return value
bool A boolean indicating whether or not an entity with the given machine name exists or not.
File
- src/
Form/ ColorForm.php, line 180
Class
- ColorForm
- Form handler for the Color add and edit forms.
Namespace
Drupal\colorapi\FormCode
public function checkMachineName($id) {
$entity = $this->entityTypeManager
->getStorage('colorapi_color')
->getQuery()
->condition('id', $id)
->execute();
return (bool) $entity;
}