Mercurial > hg > isophonics-drupal-site
comparison core/modules/contact/src/Controller/ContactController.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
57 public function contactSitePage(ContactFormInterface $contact_form = NULL) { | 57 public function contactSitePage(ContactFormInterface $contact_form = NULL) { |
58 $config = $this->config('contact.settings'); | 58 $config = $this->config('contact.settings'); |
59 | 59 |
60 // Use the default form if no form has been passed. | 60 // Use the default form if no form has been passed. |
61 if (empty($contact_form)) { | 61 if (empty($contact_form)) { |
62 $contact_form = $this->entityManager() | 62 $contact_form = $this->entityTypeManager() |
63 ->getStorage('contact_form') | 63 ->getStorage('contact_form') |
64 ->load($config->get('default_form')); | 64 ->load($config->get('default_form')); |
65 // If there are no forms, do not display the form. | 65 // If there are no forms, do not display the form. |
66 if (empty($contact_form)) { | 66 if (empty($contact_form)) { |
67 if ($this->currentUser()->hasPermission('administer contact forms')) { | 67 if ($this->currentUser()->hasPermission('administer contact forms')) { |
74 throw new NotFoundHttpException(); | 74 throw new NotFoundHttpException(); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 $message = $this->entityManager() | 79 $message = $this->entityTypeManager() |
80 ->getStorage('contact_message') | 80 ->getStorage('contact_message') |
81 ->create([ | 81 ->create([ |
82 'contact_form' => $contact_form->id(), | 82 'contact_form' => $contact_form->id(), |
83 ]); | 83 ]); |
84 | 84 |
107 // Do not continue if the user does not have an email address configured. | 107 // Do not continue if the user does not have an email address configured. |
108 if (!$user->getEmail()) { | 108 if (!$user->getEmail()) { |
109 throw new NotFoundHttpException(); | 109 throw new NotFoundHttpException(); |
110 } | 110 } |
111 | 111 |
112 $message = $this->entityManager()->getStorage('contact_message')->create([ | 112 $message = $this->entityTypeManager()->getStorage('contact_message')->create([ |
113 'contact_form' => 'personal', | 113 'contact_form' => 'personal', |
114 'recipient' => $user->id(), | 114 'recipient' => $user->id(), |
115 ]); | 115 ]); |
116 | 116 |
117 $form = $this->entityFormBuilder()->getForm($message); | 117 $form = $this->entityFormBuilder()->getForm($message); |