public function PresetFormBase::exists in Video 8.2
Checks for an existing presets.
Parameters
string|int $entity_id: The entity ID.
array $element: The form element.
FormStateInterface $form_state: The form state.
Return value
bool TRUE if this format already exists, FALSE otherwise.
File
- modules/
video_transcode/ src/ Form/ PresetFormBase.php, line 523
Class
- PresetFormBase
- Class PresetFormBase.
Namespace
Drupal\video_transcode\FormCode
public function exists($entity_id, array $element, FormStateInterface $form_state) {
// Use the entity type manager to build a new preset entity query.
$query = $this->entityTypeManager
->getStorage('video_transcode_preset')
->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;
}