You are here

public static function LegacyWrapper::getFormDisplay in Mini site 8

Returns the entity form display associated with a bundle and form mode.

Throws

\RuntimeException If compatible function is not found.

File

src/LegacyWrapper.php, line 84

Class

LegacyWrapper
Class LegacyWrapper.

Namespace

Drupal\minisite

Code

public static function getFormDisplay($entity_type, $bundle, $form_mode) {
  $dr = \Drupal::service('entity_display.repository');
  if (method_exists(get_class($dr), 'getFormDisplay')) {
    return $dr
      ->getFormDisplay($entity_type, $bundle, $form_mode);
  }
  if (function_exists('entity_get_display')) {
    return entity_get_form_display($entity_type, $bundle, $form_mode);
  }
  throw new \RuntimeException('Unable to find compatible function');
}