public function AutobanFormBase::exists in Automatic IP ban (Autoban) 8
Checks for an existing autoban rule.
Parameters
string|int $entity_id: The entity ID.
array $element: The form element.
Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
bool TRUE if this format already exists, FALSE otherwise.
File
- src/Form/ AutobanFormBase.php, line 290 
- Class AutobanFormBase.
Class
- AutobanFormBase
- Autoban base form for add and edit.
Namespace
Drupal\autoban\FormCode
public function exists($entity_id, array $element, FormStateInterface $form_state) {
  $query = $this->entityTypeManager
    ->getStorage('autoban')
    ->getQuery();
  $result = $query
    ->condition('id', $element['#field_prefix'] . $entity_id)
    ->execute();
  return (bool) $result;
}