public function SearchPageFormBase::exists in Drupal 9
Same name and namespace in other branches
- 8 core/modules/search/src/Form/SearchPageFormBase.php \Drupal\search\Form\SearchPageFormBase::exists()
Determines if the search page entity already exists.
Parameters
string $id: The search configuration ID.
Return value
bool TRUE if the search configuration exists, FALSE otherwise.
File
- core/
modules/ search/ src/ Form/ SearchPageFormBase.php, line 121
Class
- SearchPageFormBase
- Provides a base form for search pages.
Namespace
Drupal\search\FormCode
public function exists($id) {
$entity = $this->entityTypeManager
->getStorage('search_page')
->getQuery()
->condition('id', $id)
->execute();
return (bool) $entity;
}