class Message

Defines the contact message entity.

Plugin annotation


@EntityType(
  id = "contact_message",
  label = @Translation("Contact message"),
  module = "contact",
  controllers = {
    "storage" = "Drupal\Core\Entity\DatabaseStorageController",
    "render" = "Drupal\contact\MessageRenderController",
    "form" = {
      "default" = "Drupal\contact\MessageFormController"
    }
  },
  entity_keys = {
    "bundle" = "category"
  },
  fieldable = TRUE,
  bundle_keys = {
    "bundle" = "id"
  }
)

Hierarchy

Expanded class hierarchy of Message

10 string references to 'Message'
contact_field_extra_fields in drupal/core/modules/contact/contact.module
Implements hook_field_extra_fields().
DbLogController::overview in drupal/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
Displays a listing of database log messages.
dblog_event in drupal/core/modules/dblog/dblog.admin.inc
Page callback: Displays details about a specific database log message.
dblog_top in drupal/core/modules/dblog/dblog.admin.inc
Page callback: Shows the most frequent log messages of a given event type.
EmailAction::form in drupal/core/modules/action/lib/Drupal/action/Plugin/Action/EmailAction.php
Form constructor.

... See full list

File

drupal/core/modules/contact/lib/Drupal/contact/Plugin/Core/Entity/Message.php, line 38
Contains Drupal\contact\Plugin\Core\Entity\Message.

Namespace

Drupal\contact\Plugin\Core\Entity
View source
class Message extends Entity implements MessageInterface {

  /**
   * The contact category ID of this message.
   *
   * @var string
   */
  public $category;

  /**
   * The sender's name.
   *
   * @var string
   */
  public $name;

  /**
   * The sender's e-mail address.
   *
   * @var string
   */
  public $mail;

  /**
   * The user account object of the message recipient.
   *
   * Only applies to the user contact form. For a site contact form category,
   * multiple recipients can be configured. The existence of a $recipient
   * triggers user contact form specific processing in the contact message form
   * controller.
   *
   * @see Drupal\contact\MessageFormController::form()
   * @see Drupal\contact\MessageFormController::save()
   *
   * @todo Replace Category::$recipients with the user account's e-mail address
   *   upon Entity::create().
   *
   * @var Drupal\user\Plugin\Core\Entity\User
   */
  public $recipient;

  /**
   * The message subject.
   *
   * @var string
   */
  public $subject;

  /**
   * The message text.
   *
   * @var string
   */
  public $message;

  /**
   * Whether to send a copy of the message to the sender.
   *
   * @var bool
   */
  public $copy;

  /**
   * Overrides Drupal\Core\Entity\Entity::id().
   */
  public function id() {
    return NULL;
  }

  /**
   * Overrides Drupal\Core\Entity\Entity::bundle().
   */
  public function bundle() {
    return $this->category;
  }

  /**
   * {@inheritdoc}
   */
  public function isPersonal() {
    return $this
      ->bundle() == 'personal';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Entity::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
Entity::$entityType protected property The entity type.
Entity::$isDefaultRevision protected property Indicates whether this is the default revision. 1
Entity::$langcode public property The language code of the entity's default language. 7
Entity::$newRevision protected property Boolean indicating whether a new revision should be created on save.
Entity::access public function Implements \Drupal\Core\TypedData\AccessibleInterface::access(). Overrides AccessibleInterface::access
Entity::createDuplicate public function Implements \Drupal\Core\Entity\EntityInterface::createDuplicate(). Overrides EntityInterface::createDuplicate 3
Entity::delete public function Implements \Drupal\Core\Entity\EntityInterface::delete(). Overrides EntityInterface::delete 3
Entity::enforceIsNew public function Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew(). Overrides EntityInterface::enforceIsNew
Entity::entityInfo public function Implements \Drupal\Core\Entity\EntityInterface::entityInfo(). Overrides EntityInterface::entityInfo
Entity::entityType public function Implements \Drupal\Core\Entity\EntityInterface::entityType(). Overrides EntityInterface::entityType
Entity::get public function Implements \Drupal\Core\Entity\EntityInterface::get(). Overrides ComplexDataInterface::get 2
Entity::getBCEntity public function Implements \Drupal\Core\Entity\EntityInterface::getBCEntity(). Overrides EntityInterface::getBCEntity 1
Entity::getConstraints public function Implements \Drupal\Core\TypedData\TypedDataInterface::getConstraints(). Overrides TypedDataInterface::getConstraints
Entity::getDefinition public function Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition(). Overrides TypedDataInterface::getDefinition
Entity::getExportProperties public function Implements \Drupal\Core\Entity\EntityInterface::getExportProperties(). Overrides EntityInterface::getExportProperties 1
Entity::getIterator public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getIterator(). 1
Entity::getName public function Implements \Drupal\Core\TypedData\TypedDataInterface::getName(). Overrides TypedDataInterface::getName
Entity::getNGEntity public function Implements \Drupal\Core\Entity\EntityInterface::getNGEntity(). Overrides EntityInterface::getNGEntity
Entity::getParent public function Implements \Drupal\Core\TypedData\TypedDataInterface::getParent(). Overrides TypedDataInterface::getParent
Entity::getProperties public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties(). Overrides ComplexDataInterface::getProperties 1
Entity::getPropertyDefinition public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition(). Overrides ComplexDataInterface::getPropertyDefinition 1
Entity::getPropertyDefinitions public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). Overrides ComplexDataInterface::getPropertyDefinitions 1
Entity::getPropertyPath public function Implements \Drupal\Core\TypedData\TypedDataInterface::getPropertyPath(). Overrides TypedDataInterface::getPropertyPath
Entity::getPropertyValues public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues(). Overrides ComplexDataInterface::getPropertyValues 1
Entity::getRevisionId public function Implements \Drupal\Core\Entity\EntityInterface::getRevisionId(). Overrides EntityInterface::getRevisionId 4
Entity::getRoot public function Implements \Drupal\Core\TypedData\TypedDataInterface::getRoot(). Overrides TypedDataInterface::getRoot
Entity::getString public function Implements \Drupal\Core\TypedData\TypedDataInterface::getString(). Overrides TypedDataInterface::getString
Entity::getTranslation public function Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation(). Overrides TranslatableInterface::getTranslation 1
Entity::getTranslationLanguages public function Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages(). Overrides TranslatableInterface::getTranslationLanguages 1
Entity::getType public function Implements \Drupal\Core\TypedData\TypedDataInterface::getType(). Overrides TypedDataInterface::getType 2
Entity::getValue public function Implements \Drupal\Core\TypedData\TypedDataInterface::getValue(). Overrides TypedDataInterface::getValue
Entity::isDefaultRevision public function Implements \Drupal\Core\Entity\EntityInterface::isDefaultRevision(). Overrides EntityInterface::isDefaultRevision 1
Entity::isEmpty public function Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty(). Overrides ComplexDataInterface::isEmpty 1
Entity::isNew public function Implements \Drupal\Core\Entity\EntityInterface::isNew(). Overrides EntityInterface::isNew 1
Entity::isNewRevision public function Implements \Drupal\Core\Entity\EntityInterface::isNewRevision(). Overrides EntityInterface::isNewRevision
Entity::isTranslatable public function Implements \Drupal\Core\Entity\EntityInterface::isTranslatable(). Overrides EntityInterface::isTranslatable
Entity::label public function Implements \Drupal\Core\Entity\EntityInterface::label(). Overrides EntityInterface::label 4
Entity::language public function Implements \Drupal\Core\TypedData\TranslatableInterface::language(). Overrides TranslatableInterface::language 1
Entity::onChange public function Implements \Drupal\Core\TypedData\ComplexDataInterface::onChange(). Overrides ComplexDataInterface::onChange
Entity::save public function Implements \Drupal\Core\Entity\EntityInterface::save(). Overrides EntityInterface::save 6
Entity::set public function Implements \Drupal\Core\TypedData\ComplexDataInterface::set(). Overrides ComplexDataInterface::set 2
Entity::setContext public function Implements \Drupal\Core\TypedData\TypedDataInterface::setContext(). Overrides TypedDataInterface::setContext
Entity::setNewRevision public function Implements \Drupal\Core\Entity\EntityInterface::setNewRevision(). Overrides EntityInterface::setNewRevision
Entity::setPropertyValues public function Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues(). Overrides ComplexDataInterface::setPropertyValues 1
Entity::setValue public function Implements \Drupal\Core\TypedData\TypedDataInterface::setValue(). Overrides TypedDataInterface::setValue
Entity::translations public function Returns the languages the entity is translated to. 1
Entity::uri public function Implements \Drupal\Core\Entity\EntityInterface::uri(). Overrides EntityInterface::uri 8
Entity::uriRelationships public function Returns a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
Entity::uuid public function Implements \Drupal\Core\Entity\EntityInterface::uuid(). Overrides EntityInterface::uuid 1
Entity::validate public function Implements \Drupal\Core\TypedData\TypedDataInterface::validate(). Overrides TypedDataInterface::validate 1
Entity::__construct public function Constructs an Entity object. 2
Message::$category public property The contact category ID of this message.
Message::$copy public property Whether to send a copy of the message to the sender.
Message::$mail public property The sender's e-mail address.
Message::$message public property The message text.
Message::$name public property The sender's name.
Message::$recipient public property The user account object of the message recipient.
Message::$subject public property The message subject.
Message::bundle public function Overrides Drupal\Core\Entity\Entity::bundle(). Overrides Entity::bundle
Message::id public function Overrides Drupal\Core\Entity\Entity::id(). Overrides Entity::id
Message::isPersonal public function Return TRUE if this is the personal contact form. Overrides MessageInterface::isPersonal