You are here

ContactFormRevisions.php in Config Entity Revisions 8.2

File

modules/contact_form_revisions/src/Entity/ContactFormRevisions.php
View source
<?php

namespace Drupal\contact_form_revisions\Entity;

use Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityInterface;
use Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityTrait;
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Entity\EntityTypeManager;

/**
 * Class ContactFormRevisions.
 *
 * @package Drupal\contact_form_revisions\Entity
 */
class ContactFormRevisions extends ContactForm implements ConfigEntityRevisionsConfigEntityInterface {
  use ConfigEntityRevisionsConfigEntityTrait;

  /**
   * The entity type manager instance.
   *
   * @var \Drupal\Core\Entity\EntityTypeManager
   */
  public $entityTypeManager;

  // Declare these fields so they're put in the storage object instead of the
  // ContactUI object during entity building. We can then access them in
  // createUpdateRevision.

  /**
   * The revision object.
   *
   * @var int
   */
  protected $revision;

  /**
   * The revision log message.
   *
   * @var array
   */
  protected $revision_log_message;

  /**
   * Constructs an Entity object.
   *
   * @param array $values
   *   An array of values to set, keyed by property name. If the entity type
   *   has bundles, the bundle key has to be specified.
   * @param string $entity_type
   *   The type of the entity to create.
   */
  public function __construct(array $values, $entity_type) {
    parent::__construct($values, $entity_type);
    $this->entityTypeManager = \Drupal::service('entity_type.manager');
  }

}

Classes

Namesort descending Description
ContactFormRevisions Class ContactFormRevisions.