Skip to content
ContactForm.php 3.3 KiB
Newer Older
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
 *   id = "contact_form",
 *   label = @Translation("Contact form"),
 *     "access" = "Drupal\contact\ContactFormAccessControlHandler",
 *     "list_builder" = "Drupal\contact\ContactFormListBuilder",
 *       "add" = "Drupal\contact\ContactFormEditForm",
 *       "edit" = "Drupal\contact\ContactFormEditForm",
 *       "delete" = "Drupal\Core\Entity\EntityDeleteForm"
 *   admin_permission = "administer contact forms",
 *     "delete-form" = "/admin/structure/contact/manage/{contact_form}/delete",
 *     "edit-form" = "/admin/structure/contact/manage/{contact_form}",
 *     "collection" = "/admin/structure/contact",
 *     "canonical" = "/contact/{contact_form}",
 *   },
 *   config_export = {
 *     "id",
 *     "label",
 *     "recipients",
 *     "reply",
 *     "weight",
class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface {
   * The human-readable label of the category.
  /**
   * The message displayed to user on form submission.
   *
   * @var string
   */
  protected $message;

   * List of recipient email addresses.
  /**
   * The path to redirect to on form submission.
   *
   * @var string
   */
  protected $redirect;

  /**
   * {@inheritdoc}
   */
  public function getMessage() {
    return $this->message;
  }

  /**
   * {@inheritdoc}
   */
  public function setMessage($message) {
    $this->message = $message;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getRecipients() {
  }

  /**
   * {@inheritdoc}
   */
  public function setRecipients($recipients) {
  /**
   * {@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() {
  }

  /**
   * {@inheritdoc}
   */
  public function setReply($reply) {
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getWeight() {
  }

  /**
   * {@inheritdoc}
   */
  public function setWeight($weight) {