/** * Checks for an existing date format. * * @param string|int $entity_id * The entity ID. * @param array $element * The form element. * * @return bool * TRUE if this format already exists, FALSE otherwise. */ public function exists($entity_id, array $element) { return (bool) $this->dateFormatStorage->getQuery()->condition('id', $element['#field_prefix'] . $entity_id)->execute(); }