You are here

public function DateFormatFormBase::exists in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::exists()

Checks for an existing date format.

Parameters

string|int $entity_id: The entity ID.

array $element: The form element.

Return value

bool TRUE if this format already exists, FALSE otherwise.

File

core/modules/system/src/Form/DateFormatFormBase.php, line 65

Class

DateFormatFormBase
Provides a base form for date formats.

Namespace

Drupal\system\Form

Code

public function exists($entity_id, array $element) {
  return (bool) $this->dateFormatStorage
    ->getQuery()
    ->condition('id', $element['#field_prefix'] . $entity_id)
    ->execute();
}