public function ContextManager::contextExists in Context 8.0
Same name and namespace in other branches
- 8.4 src/ContextManager.php \Drupal\context\ContextManager::contextExists()
- 8 src/ContextManager.php \Drupal\context\ContextManager::contextExists()
Check to validate that the context name does not already exist.
Parameters
string $name: The machine name of the context to validate.
Return value
bool
File
- src/ContextManager.php, line 148 
Class
- ContextManager
- This is the manager service for the context module and should not be confused with the built in contexts in Drupal.
Namespace
Drupal\contextCode
public function contextExists($name) {
  $entity = $this->entityQuery
    ->get('context')
    ->condition('name', $name)
    ->execute();
  return (bool) $entity;
}