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"),
15 * label_collection = @Translation("Contact forms"),
16 * label_singular = @Translation("contact form"),
17 * label_plural = @Translation("contact forms"),
18 * label_count = @PluralTranslation(
19 * singular = "@count contact form",
20 * plural = "@count contact forms",
23 * "access" = "Drupal\contact\ContactFormAccessControlHandler",
24 * "list_builder" = "Drupal\contact\ContactFormListBuilder",
26 * "add" = "Drupal\contact\ContactFormEditForm",
27 * "edit" = "Drupal\contact\ContactFormEditForm",
28 * "delete" = "Drupal\Core\Entity\EntityDeleteForm"
31 * config_prefix = "form",
32 * admin_permission = "administer contact forms",
33 * bundle_of = "contact_message",
39 * "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete",
40 * "edit-form" = "/admin/structure/contact/manage/{contact_form}",
41 * "collection" = "/admin/structure/contact",
42 * "canonical" = "/contact/{contact_form}",
55 class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface {
65 * The human-readable label of the category.
72 * The message displayed to user on form submission.
79 * List of recipient email addresses.
83 protected $recipients = [];
86 * The path to redirect to on form submission.
93 * An auto-reply message.
97 protected $reply = '';
100 * The weight of the category.
104 protected $weight = 0;
109 public function getMessage() {
110 return $this->message;
116 public function setMessage($message) {
117 $this->message = $message;
124 public function getRecipients() {
125 return $this->recipients;
131 public function setRecipients($recipients) {
132 $this->recipients = $recipients;
139 public function getRedirectPath() {
140 return $this->redirect;
146 public function getRedirectUrl() {
147 if ($this->redirect) {
148 $url = Url::fromUserInput($this->redirect);
151 $url = Url::fromRoute('<front>');
159 public function setRedirectPath($redirect) {
160 $this->redirect = $redirect;
167 public function getReply() {
174 public function setReply($reply) {
175 $this->reply = $reply;
182 public function getWeight() {
183 return $this->weight;
189 public function setWeight($weight) {
190 $this->weight = $weight;