Unverified Commit f9f653d6 authored by andypost's avatar andypost Committed by larowlan

Issue #2907536 by bapi_22, andypost, Venkatesh Rajan.J, Berdir, larowlan:...

Issue #2907536 by bapi_22, andypost, Venkatesh Rajan.J, Berdir, larowlan: Remove deprecated method entityManager()
parent c14dad7a
......@@ -21,8 +21,9 @@ class ContactStorageController extends ContactController {
$config = $this->config('contact.settings');
// Use the default form if no form has been passed.
$manager = $this->entityTypeManager();
if (empty($contact_form)) {
$contact_form = $this->entityManager()
$contact_form = $manager
->getStorage('contact_form')
->load($config->get('default_form'));
// If there are no forms, do not display the form.
......@@ -38,7 +39,7 @@ class ContactStorageController extends ContactController {
}
}
$view_builder = $this->entityTypeManager()->getViewBuilder('contact_form');
$view_builder = $manager->getViewBuilder('contact_form');
return $view_builder->view($contact_form, 'full', $contact_form->language());
}
......
......@@ -3,46 +3,13 @@
namespace Drupal\contact_storage;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form controller for contact message edit forms.
*/
class MessageEditForm extends ContentEntityForm {
/**
* The language manager service.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a MessageEditForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager service.
*/
public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) {
parent::__construct($entity_manager);
$this->languageManager = $language_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('language_manager')
);
}
/**
* {@inheritdoc}
*/
......
......@@ -35,7 +35,7 @@ class ContactForm extends FieldPluginBase {
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager')->getStorage('contact_form'));
return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity_type.manager')->getStorage('contact_form'));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment