function DateFormatFormBase::exists

Same name in other branches
  1. 9 core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::exists()
  2. 10 core/modules/system/src/Form/DateFormatFormBase.php \Drupal\system\Form\DateFormatFormBase::exists()
  3. 11.x 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.