ContactForm.php
Same filename in other branches
Namespace
Drupal\contact\EntityFile
-
core/
modules/ contact/ src/ Entity/ ContactForm.php
View source
<?php
namespace Drupal\contact\Entity;
use Drupal\contact\ContactFormAccessControlHandler;
use Drupal\contact\ContactFormEditForm;
use Drupal\contact\ContactFormInterface;
use Drupal\contact\ContactFormListBuilder;
use Drupal\Core\Config\Action\Attribute\ActionMethod;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\Core\Entity\Attribute\ConfigEntityType;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\user\Entity\EntityPermissionsRouteProvider;
/**
* Defines the contact form entity.
*/
class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface {
/**
* The form ID.
*
* @var string
*/
protected $id;
/**
* The human-readable label of the category.
*
* @var string
*/
protected $label;
/**
* The message displayed to user on form submission.
*
* @var string
*/
protected $message;
/**
* List of recipient email addresses.
*
* @var array
*/
protected $recipients = [];
/**
* The path to redirect to on form submission.
*
* @var string
*/
protected $redirect;
/**
* An auto-reply message.
*
* @var string
*/
protected $reply = '';
/**
* The weight of the category.
*
* @var int
*/
protected $weight = 0;
/**
* {@inheritdoc}
*/
public function getMessage() {
return $this->message;
}
/**
* {@inheritdoc}
*/
public function setMessage($message) {
$this->message = $message;
return $this;
}
/**
* {@inheritdoc}
*/
public function getRecipients() {
return $this->recipients;
}
/**
* {@inheritdoc}
*/
public function setRecipients($recipients) {
$this->recipients = $recipients;
return $this;
}
/**
* {@inheritdoc}
*/
public function getRedirectPath() {
return $this->redirect;
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl() {
if ($this->redirect) {
$url = Url::fromUserInput($this->redirect);
}
else {
$url = Url::fromRoute('<front>');
}
return $url;
}
/**
* {@inheritdoc}
*/
public function setRedirectPath($redirect) {
$this->redirect = $redirect;
return $this;
}
/**
* {@inheritdoc}
*/
public function getReply() {
return $this->reply;
}
/**
* {@inheritdoc}
*/
public function setReply($reply) {
$this->reply = $reply;
return $this;
}
/**
* {@inheritdoc}
*/
public function getWeight() {
return $this->weight;
}
/**
* {@inheritdoc}
*/
public function setWeight($weight) {
$this->weight = $weight;
return $this;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
ContactForm | Defines the contact form entity. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.