Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecation solution in Wiki: entity_get[_form]_display #77

Open
anotherjames opened this issue May 28, 2019 · 0 comments
Open

Comments

@anotherjames
Copy link

Since https://www.drupal.org/node/2367933 / https://git.drupalcode.org/project/drupal/commit/da94d7fc6b6cd06a26c065ab8db640e9a0bb8671#7f7e72269405002d6602cb72b6155307148e699d_523_487 , the deprecation solution for usage of entity_get_display() and entity_get_form_display() have changed. The solutions should now be:

\Drupal::service('entity_display.repository')
  ->getViewDisplay($entity_type, $bundle, $view_mode);

and

\Drupal::service('entity_display.repository')
  ->getFormDisplay($entity_type, $bundle, $form_mode);

This ensures a valid display is returned even when it doesn't yet exist as saved configuration, just as entity_get_display() and entity_get_form_display() did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant