You are here

interface WebformMessageManagerInterface in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformMessageManagerInterface.php \Drupal\webform\WebformMessageManagerInterface

Provides an interface for managing a webform's custom, default, and hard-coded messages.

Hierarchy

Expanded class hierarchy of WebformMessageManagerInterface

All classes that implement WebformMessageManagerInterface

6 files declare their use of WebformMessageManagerInterface
RemotePostWebformHandler.php in src/Plugin/WebformHandler/RemotePostWebformHandler.php
webform.theme.template.inc in includes/webform.theme.template.inc
Preprocessors and helper functions to make theming easier.
WebformEntityReferenceLinkFormatter.php in src/Plugin/Field/FieldFormatter/WebformEntityReferenceLinkFormatter.php
WebformEntitySettingsGeneralForm.php in src/EntitySettings/WebformEntitySettingsGeneralForm.php
WebformMessageManagerTest.php in tests/src/Unit/WebformMessageManagerTest.php

... See full list

File

src/WebformMessageManagerInterface.php, line 10

Namespace

Drupal\webform
View source
interface WebformMessageManagerInterface {

  /****************************************************************************/

  // Hardcode message or custom messages with arguments constants.

  /****************************************************************************/

  /**
   * Admin closed.
   */
  const ADMIN_CLOSED = 'admin_closed';

  /**
   * Admin page.
   */
  const ADMIN_PAGE = 'admin_page';

  /**
   * Admin archived.
   */
  const ADMIN_ARCHIVED = 'admin_archived';

  /**
   * Default submission confirmation.
   */
  const SUBMISSION_DEFAULT_CONFIRMATION = 'submission_default_confirmation';

  /**
   * Submission updates.
   */
  const SUBMISSION_UPDATED = 'submission_updated';

  /**
   * Submission test.
   */
  const SUBMISSION_TEST = 'submission_test';

  /**
   * Webform not saving or sending any data.
   */
  const FORM_SAVE_EXCEPTION = 'form_save_exception';

  /**
   * Webform not able to handle file uploads.
   */
  const FORM_FILE_UPLOAD_EXCEPTION = 'form_file_upload_exception';

  /**
   * Handler submission test.
   */
  const HANDLER_SUBMISSION_REQUIRED = 'handler_submission_required';

  /****************************************************************************/

  // Configurable custom message constants with :href argument.
  // Values corresponds to admin config and webform settings
  // with *_message appended.

  /****************************************************************************/

  /**
   * Submission previous.
   */
  const PREVIOUS_SUBMISSION = 'previous_submission';

  /**
   * Submissions previous.
   */
  const PREVIOUS_SUBMISSIONS = 'previous_submissions';

  /**
   * Draft pending single.
   */
  const DRAFT_PENDING_SINGLE = 'draft_pending_single';

  /**
   * Draft pending multiple.
   */
  const DRAFT_PENDING_MULTIPLE = 'draft_pending_multiple';

  /****************************************************************************/

  // Configurable custom message constants.
  // Values corresponds to admin config and webform settings.

  /****************************************************************************/

  /**
   * Webform exception.
   */
  const FORM_EXCEPTION_MESSAGE = 'form_exception_message';

  /**
   * Webform preview.
   */
  const FORM_PREVIEW_MESSAGE = 'preview_message';

  /**
   * Webform opening.
   */
  const FORM_OPEN_MESSAGE = 'form_open_message';

  /**
   * Webform closed.
   */
  const FORM_CLOSE_MESSAGE = 'form_close_message';

  /**
   * Webform confidential.
   */
  const FORM_CONFIDENTIAL_MESSAGE = 'form_confidential_message';

  /**
   * Limit user submission.
   */
  const LIMIT_USER_MESSAGE = 'limit_user_message';

  /**
   * Limit total submission.
   */
  const LIMIT_TOTAL_MESSAGE = 'limit_total_message';

  /**
   * Submission draft saved.
   */
  const SUBMISSION_DRAFT_SAVED_MESSAGE = 'draft_saved_message';

  /**
   * Submission draft loaded.
   */
  const SUBMISSION_DRAFT_LOADED_MESSAGE = 'draft_loaded_message';

  /**
   * Submission confirmation.
   */
  const SUBMISSION_CONFIRMATION_MESSAGE = 'confirmation_message';

  /**
   * Submission exception.
   */
  const SUBMISSION_EXCEPTION_MESSAGE = 'submission_exception_message';

  /**
   * Submission exception.
   */
  const SUBMISSION_LOCKED_MESSAGE = 'submission_locked_message';

  /**
   * Template preview.
   */
  const TEMPLATE_PREVIEW = 'template_preview';

  /**
   * Autofill.
   */
  const AUTOFILL_MESSAGE = 'autofill_message';

  /**
   * Prepopulate source entity required.
   */
  const PREPOPULATE_SOURCE_ENTITY_REQUIRED = 'prepopulate_source_entity_required';

  /**
   * Prepopulate source entity type.
   */
  const PREPOPULATE_SOURCE_ENTITY_TYPE = 'prepopulate_source_entity_type';

  /**
   * Set the webform submission used for token replacement.
   *
   * Webform and source entity will also be set using the webform submission.
   *
   * @param \Drupal\webform\WebformSubmissionInterface $webform_submission
   *   A webform submission.
   */
  public function setWebformSubmission(WebformSubmissionInterface $webform_submission = NULL);

  /**
   * Set the webform used for custom messages and token replacement.
   *
   * @param \Drupal\webform\WebformInterface $webform
   *   A webform.
   */
  public function setWebform(WebformInterface $webform = NULL);

  /**
   * Set the webform source entity whose submissions are being exported.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity.
   */
  public function setSourceEntity(EntityInterface $entity = NULL);

  /**
   * Get message.
   *
   * @param string $key
   *   The name of webform settings message to be displayed.
   *
   * @return string|bool
   *   A message or FALSE if no message is found.
   */
  public function get($key);

  /**
   * Append inline message message to a render array.
   *
   * @param array $build
   *   A render array.
   * @param string $key
   *   The name of webform settings message to be displayed.
   * @param string $type
   *   (optional) The message's type. Defaults to 'status'. These values are
   *   supported:
   *   - 'status'.
   *   - 'warning'.
   *   - 'error'.
   *
   * @return array
   *   The render array with webform inline message appended.
   */
  public function append(array $build, $key, $type = 'status');

  /**
   * Display message.
   *
   * @param string $key
   *   The name of webform settings message to be displayed.
   * @param string $type
   *   (optional) The message's type. Defaults to 'status'. These values are
   *   supported:
   *   - 'status'.
   *   - 'warning'.
   *   - 'error'.
   */
  public function display($key, $type = 'status');

  /**
   * Render message.
   *
   * @return \Drupal\Core\Render\Markup|null
   *   A rendered message.
   */
  public function render($key);

  /**
   * Build message.
   *
   * @return array
   *   A render array containing a message.
   */
  public function build($key);

  /**
   * Log message.
   *
   * @param string $key
   *   The name of webform settings message to be logged.
   * @param string $type
   *   (optional) The message's type. Defaults to 'warning'. These values are
   *   supported:
   *   - 'notice'.
   *   - 'warning'.
   *   - 'error'.
   */
  public function log($key, $type = 'warning');

}

Members

Namesort descending Modifiers Type Description Overrides
WebformMessageManagerInterface::ADMIN_ARCHIVED constant Admin archived.
WebformMessageManagerInterface::ADMIN_CLOSED constant Admin closed.
WebformMessageManagerInterface::ADMIN_PAGE constant Admin page.
WebformMessageManagerInterface::append public function Append inline message message to a render array. 1
WebformMessageManagerInterface::AUTOFILL_MESSAGE constant Autofill.
WebformMessageManagerInterface::build public function Build message. 1
WebformMessageManagerInterface::display public function Display message. 1
WebformMessageManagerInterface::DRAFT_PENDING_MULTIPLE constant Draft pending multiple.
WebformMessageManagerInterface::DRAFT_PENDING_SINGLE constant Draft pending single.
WebformMessageManagerInterface::FORM_CLOSE_MESSAGE constant Webform closed.
WebformMessageManagerInterface::FORM_CONFIDENTIAL_MESSAGE constant Webform confidential.
WebformMessageManagerInterface::FORM_EXCEPTION_MESSAGE constant Webform exception.
WebformMessageManagerInterface::FORM_FILE_UPLOAD_EXCEPTION constant Webform not able to handle file uploads.
WebformMessageManagerInterface::FORM_OPEN_MESSAGE constant Webform opening.
WebformMessageManagerInterface::FORM_PREVIEW_MESSAGE constant Webform preview.
WebformMessageManagerInterface::FORM_SAVE_EXCEPTION constant Webform not saving or sending any data.
WebformMessageManagerInterface::get public function Get message. 1
WebformMessageManagerInterface::HANDLER_SUBMISSION_REQUIRED constant Handler submission test.
WebformMessageManagerInterface::LIMIT_TOTAL_MESSAGE constant Limit total submission.
WebformMessageManagerInterface::LIMIT_USER_MESSAGE constant Limit user submission.
WebformMessageManagerInterface::log public function Log message. 1
WebformMessageManagerInterface::PREPOPULATE_SOURCE_ENTITY_REQUIRED constant Prepopulate source entity required.
WebformMessageManagerInterface::PREPOPULATE_SOURCE_ENTITY_TYPE constant Prepopulate source entity type.
WebformMessageManagerInterface::PREVIOUS_SUBMISSION constant Submission previous.
WebformMessageManagerInterface::PREVIOUS_SUBMISSIONS constant Submissions previous.
WebformMessageManagerInterface::render public function Render message. 1
WebformMessageManagerInterface::setSourceEntity public function Set the webform source entity whose submissions are being exported. 1
WebformMessageManagerInterface::setWebform public function Set the webform used for custom messages and token replacement. 1
WebformMessageManagerInterface::setWebformSubmission public function Set the webform submission used for token replacement. 1
WebformMessageManagerInterface::SUBMISSION_CONFIRMATION_MESSAGE constant Submission confirmation.
WebformMessageManagerInterface::SUBMISSION_DEFAULT_CONFIRMATION constant Default submission confirmation.
WebformMessageManagerInterface::SUBMISSION_DRAFT_LOADED_MESSAGE constant Submission draft loaded.
WebformMessageManagerInterface::SUBMISSION_DRAFT_SAVED_MESSAGE constant Submission draft saved.
WebformMessageManagerInterface::SUBMISSION_EXCEPTION_MESSAGE constant Submission exception.
WebformMessageManagerInterface::SUBMISSION_LOCKED_MESSAGE constant Submission exception.
WebformMessageManagerInterface::SUBMISSION_TEST constant Submission test.
WebformMessageManagerInterface::SUBMISSION_UPDATED constant Submission updates.
WebformMessageManagerInterface::TEMPLATE_PREVIEW constant Template preview.