3 namespace Drupal\contact\Entity;
5 use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
6 use Drupal\contact\ContactFormInterface;
10 * Defines the contact form entity.
13 * id = "contact_form",
14 * label = @Translation("Contact form"),
16 * "access" = "Drupal\contact\ContactFormAccessControlHandler",
17 * "list_builder" = "Drupal\contact\ContactFormListBuilder",
19 * "add" = "Drupal\contact\ContactFormEditForm",
20 * "edit" = "Drupal\contact\ContactFormEditForm",
21 * "delete" = "Drupal\Core\Entity\EntityDeleteForm"
24 * config_prefix = "form",
25 * admin_permission = "administer contact forms",
26 * bundle_of = "contact_message",
32 * "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete",
33 * "edit-form" = "/admin/structure/contact/manage/{contact_form}",
34 * "collection" = "/admin/structure/contact",
35 * "canonical" = "/contact/{contact_form}",
48 class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface {
58 * The human-readable label of the category.
65 * The message displayed to user on form submission.
72 * List of recipient email addresses.
76 protected $recipients = [];
79 * The path to redirect to on form submission.
86 * An auto-reply message.
90 protected $reply = '';
93 * The weight of the category.
97 protected $weight = 0;
102 public function getMessage() {
103 return $this->message;
109 public function setMessage($message) {
110 $this->message = $message;
117 public function getRecipients() {
118 return $this->recipients;
124 public function setRecipients($recipients) {
125 $this->recipients = $recipients;
132 public function getRedirectPath() {
133 return $this->redirect;
139 public function getRedirectUrl() {
140 if ($this->redirect) {
141 $url = Url::fromUserInput($this->redirect);
144 $url = Url::fromRoute('<front>');
152 public function setRedirectPath($redirect) {
153 $this->redirect = $redirect;
160 public function getReply() {
167 public function setReply($reply) {
168 $this->reply = $reply;
175 public function getWeight() {
176 return $this->weight;
182 public function setWeight($weight) {
183 $this->weight = $weight;