class ContactForm
Same name in other branches
- 9 core/modules/contact/src/Entity/ContactForm.php \Drupal\contact\Entity\ContactForm
- 8.9.x core/modules/contact/src/Entity/ContactForm.php \Drupal\contact\Entity\ContactForm
- 11.x core/modules/contact/src/Entity/ContactForm.php \Drupal\contact\Entity\ContactForm
Defines the contact form entity.
Plugin annotation
@ConfigEntityType(
id = "contact_form",
label = @Translation("Contact form"),
label_collection = @Translation("Contact forms"),
label_singular = @Translation("contact form"),
label_plural = @Translation("contact forms"),
label_count = @PluralTranslation(
singular = "@count contact form",
plural = "@count contact forms",
),
handlers = {
"access" = "Drupal\contact\ContactFormAccessControlHandler",
"list_builder" = "Drupal\contact\ContactFormListBuilder",
"form" = {
"add" = "Drupal\contact\ContactFormEditForm",
"edit" = "Drupal\contact\ContactFormEditForm",
"delete" = "Drupal\Core\Entity\EntityDeleteForm"
},
"route_provider" = {
"permissions" = "Drupal\user\Entity\EntityPermissionsRouteProviderWithCheck",
}
},
config_prefix = "form",
admin_permission = "administer contact forms",
bundle_of = "contact_message",
entity_keys = {
"id" = "id",
"label" = "label"
},
links = {
"delete-form" = "/admin/structure/contact/manage/{contact_form}/delete",
"edit-form" = "/admin/structure/contact/manage/{contact_form}",
"entity-permissions-form" = "/admin/structure/contact/manage/{contact_form}/permissions",
"collection" = "/admin/structure/contact",
"canonical" = "/contact/{contact_form}",
},
config_export = {
"id",
"label",
"recipients",
"reply",
"weight",
"message",
"redirect",
}
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Entity\EntityInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase extends \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBundleBase extends \Drupal\Core\Config\Entity\ConfigEntityBase
- class \Drupal\contact\Entity\ContactForm extends \Drupal\Core\Config\Entity\ConfigEntityBundleBase implements \Drupal\contact\ContactFormInterface
- class \Drupal\Core\Config\Entity\ConfigEntityBundleBase extends \Drupal\Core\Config\Entity\ConfigEntityBase
- class \Drupal\Core\Config\Entity\ConfigEntityBase extends \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait
Expanded class hierarchy of ContactForm
15 files declare their use of ContactForm
- ConfigTranslationListUiTest.php in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationListUiTest.php - ContactFieldsTest.php in core/
modules/ contact/ tests/ src/ Kernel/ Views/ ContactFieldsTest.php - ContactFormResourceTestBase.php in core/
modules/ contact/ tests/ src/ Functional/ Rest/ ContactFormResourceTestBase.php - ContactFormTest.php in core/
modules/ jsonapi/ tests/ src/ Functional/ ContactFormTest.php - ContactFormValidationTest.php in core/
modules/ contact/ tests/ src/ Kernel/ ContactFormValidationTest.php
File
-
core/
modules/ contact/ src/ Entity/ ContactForm.php, line 59
Namespace
Drupal\contact\EntityView source
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;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.