public function SlideBaseForm::exists in Drupal Slider 8
Same name and namespace in other branches
- 8.2 src/Form/SlideBaseForm.php \Drupal\drupal_slider\Form\SlideBaseForm::exists()
Checks an existing Slide.
File
- src/
Form/ SlideBaseForm.php, line 94
Class
- SlideBaseForm
- Class SlideBaseForm.
Namespace
Drupal\drupal_slider\FormCode
public function exists($entity_id, array $element, FormStateInterface $form_state) {
$query = $this->entityStorage
->getQuery();
// Query the entity ID to see if its in use.
$result = $query
->condition('id', $element['#field_prefix'] . $entity_id)
->execute();
// We don't need to return the ID, only if it exists or not.
return (bool) $result;
}