private function ContentEntityAutosaveFormTestBase::getEntityFormDisplay in Autosave Form 8
Returns the entity form display associated with a bundle and form mode.
This is just a wrapper around Drupal\Core\Entity\EntityDisplayRepository::getFormDisplay() for Drupal versions >= 8.8, with a fallback to entity_get_form_display() for prior Drupal versions.
@todo Remove this once Drupal 8.7 is no longer supported.
Parameters
string $entity_type: The entity type.
string $bundle: The bundle.
string $form_mode: The form mode.
Return value
\Drupal\Core\Entity\Display\EntityFormDisplayInterface The entity form display associated with the given form mode.
File
- tests/
src/ FunctionalJavascript/ ContentEntity/ ContentEntityAutosaveFormTestBase.php, line 769
Class
- ContentEntityAutosaveFormTestBase
- Base test class for testing autosave support for entity forms.
Namespace
Drupal\Tests\autosave_form\FunctionalJavascript\ContentEntityCode
private function getEntityFormDisplay($entity_type, $bundle, $form_mode) {
if (version_compare(\Drupal::VERSION, '8.8', '>=')) {
return \Drupal::service('entity_display.repository')
->getFormDisplay($entity_type, $bundle, $form_mode);
}
else {
// Because this code only runs for older Drupal versions, we do not need
// or want IDEs or the Upgrade Status module warning people about this
// deprecated code usage. Setting the function name dynamically
// circumvents those warnings.
$function = 'entity_get_form_display';
return $function($entity_type, $bundle, $form_mode);
}
}