public EntityDisplayModeFormBase::exists($entity_id, array $element)
Determines if the display mode already exists.
Parameters
string|int $entity_id: The entity ID.
array $element: The form element.
Return value
bool TRUE if the display mode exists, FALSE otherwise.
File
- core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php, line 105
Class
- EntityDisplayModeFormBase
- Provides the generic base class for entity display mode forms.
Namespace
Drupal\field_ui\Form
Code
public function exists($entity_id, array $element) {
// Do not allow to add internal 'default' view mode.
if ($entity_id == 'default') {
return TRUE;
}
return (bool) $this->queryFactory
->get($this->entity->getEntityTypeId())
->condition('id', $element['#field_prefix'] . $entity_id)
->execute();
}
Please login to continue.