You are here

class WebformTemplatesSubmissionPreviewForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_templates/src/WebformTemplatesSubmissionPreviewForm.php \Drupal\webform_templates\WebformTemplatesSubmissionPreviewForm

Preview webform submission webform.

Hierarchy

Expanded class hierarchy of WebformTemplatesSubmissionPreviewForm

File

modules/webform_templates/src/WebformTemplatesSubmissionPreviewForm.php, line 14

Namespace

Drupal\webform_templates
View source
class WebformTemplatesSubmissionPreviewForm extends WebformSubmissionForm {
  use WebformDialogFormTrait;

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state, $mode = NULL) {
    $form = parent::buildForm($form, $form_state, $mode);
    if ($this
      ->isDialog()) {

      // Disable validation.
      $form['#attributes']['novalidate'] = 'novalidate';

      // Display webform title in modal.
      $form['title'] = [
        '#markup' => $this
          ->getWebform()
          ->label(),
        '#prefix' => '<h1>',
        '#suffix' => '</h1>',
        '#weight' => -101,
      ];

      // Remove type from 'actions' and add modal 'actions'.
      unset($form['actions']['#type']);
      $form['modal_actions'] = [
        '#type' => 'actions',
      ];
      $form['modal_actions']['select'] = [
        '#type' => 'link',
        '#title' => $this
          ->t('Select'),
        '#url' => Url::fromRoute('entity.webform.duplicate_form', [
          'webform' => $this
            ->getWebform()
            ->id(),
        ]),
        '#attributes' => WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NARROW, [
          'button',
          'button--primary',
        ]),
      ];
      $form['modal_actions']['close'] = [
        '#type' => 'submit',
        '#value' => $this
          ->t('Close'),
        '#ajax' => [
          'callback' => '::closeDialog',
          'event' => 'click',
        ],
      ];
    }
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    if ($this
      ->isDialog()) {
      $form_state
        ->clearErrors();
    }
    else {
      parent::validateForm($form, $form_state);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentEntityForm::$entityRepository protected property The entity repository service.
ContentEntityForm::$entityTypeBundleInfo protected property The entity type bundle info service.
ContentEntityForm::$time protected property The time service.
ContentEntityForm::addRevisionableFormFields protected function Add revision form fields if the entity enabled the UI.
ContentEntityForm::flagViolations protected function Flags violations for the current form. 4
ContentEntityForm::getBundleEntity protected function Returns the bundle entity of the entity, or NULL if there is none.
ContentEntityForm::getEditedFieldNames protected function Gets the names of all fields edited in the form. 4
ContentEntityForm::getFormDisplay public function Gets the form display. Overrides ContentEntityFormInterface::getFormDisplay
ContentEntityForm::getFormLangcode public function Gets the code identifying the active form language. Overrides ContentEntityFormInterface::getFormLangcode
ContentEntityForm::getNewRevisionDefault protected function Should new revisions created on default.
ContentEntityForm::initFormLangcodes protected function Initializes form language code values.
ContentEntityForm::isDefaultFormLangcode public function Checks whether the current form language matches the entity one. Overrides ContentEntityFormInterface::isDefaultFormLangcode
ContentEntityForm::prepareEntity protected function Prepares the entity object before the form is built first. Overrides EntityForm::prepareEntity 1
ContentEntityForm::setFormDisplay public function Sets the form display. Overrides ContentEntityFormInterface::setFormDisplay
ContentEntityForm::showRevisionUi protected function Checks whether the revision form fields should be added to the form.
ContentEntityForm::updateChangedTime public function Updates the changed time of the entity.
ContentEntityForm::updateFormLangcode public function Updates the form language to reflect any change to the entity language.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EntityForm::$entityTypeManager protected property The entity type manager. 3
EntityForm::$moduleHandler protected property The module handler service.
EntityForm::$operation protected property The name of the current operation.
EntityForm::$privateEntityManager private property The entity manager.
EntityForm::getEntity public function Gets the form entity. Overrides EntityFormInterface::getEntity
EntityForm::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface::getEntityFromRouteMatch 1
EntityForm::getOperation public function Gets the operation identifying the form. Overrides EntityFormInterface::getOperation
EntityForm::prepareInvokeAll protected function Invokes the specified prepare hook variant.
EntityForm::processForm public function Process callback: assigns weights and hides extra fields.
EntityForm::setEntityManager public function Sets the entity manager for this form. Overrides EntityFormInterface::setEntityManager
EntityForm::setEntityTypeManager public function Sets the entity type manager for this form. Overrides EntityFormInterface::setEntityTypeManager
EntityForm::setModuleHandler public function Sets the module handler for this form. Overrides EntityFormInterface::setModuleHandler
EntityForm::setOperation public function Sets the operation for this form. Overrides EntityFormInterface::setOperation
EntityForm::__get public function
EntityForm::__set public function
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.
WebformAjaxFormTrait::announce protected function Queue announcement with Ajax response.
WebformAjaxFormTrait::buildAjaxForm protected function Add Ajax support to a form.
WebformAjaxFormTrait::createAjaxResponse protected function Create an AjaxResponse or WebformAjaxResponse object.
WebformAjaxFormTrait::getAnnouncements protected function Get announcements.
WebformAjaxFormTrait::getDefaultAjaxSettings protected function Get default ajax callback settings. 1
WebformAjaxFormTrait::getFormStateRedirectUrl protected function Get redirect URL from the form's state.
WebformAjaxFormTrait::getWrapperId protected function Get the form's Ajax wrapper id. 1
WebformAjaxFormTrait::isCallableAjaxCallback protected function Determine if Ajax callback is callable.
WebformAjaxFormTrait::isDialog protected function Is the current request for an Ajax modal/dialog.
WebformAjaxFormTrait::isOffCanvasDialog protected function Is the current request for an off canvas dialog.
WebformAjaxFormTrait::missingAjaxCallback protected function Handle missing Ajax callback.
WebformAjaxFormTrait::replaceForm protected function Replace form via an Ajax response. 1
WebformAjaxFormTrait::resetAnnouncements protected function Reset announcements.
WebformAjaxFormTrait::setAnnouncements protected function Set announcements.
WebformAjaxFormTrait::submitAjaxForm public function Submit form #ajax callback. 1
WebformAjaxFormTrait::validateAjaxForm public function Validate form #ajax callback. 1
WebformDialogFormTrait::buildDialogConfirmForm protected function Add modal dialog support to a confirm form.
WebformDialogFormTrait::buildDialogDeleteAction protected function Build webform dialog delete link.
WebformDialogFormTrait::buildDialogForm protected function Add modal dialog support to a form.
WebformDialogFormTrait::cancelAjaxForm public function Cancel form #ajax callback. Overrides WebformAjaxFormTrait::cancelAjaxForm 1
WebformDialogFormTrait::closeDialog public function Close dialog.
WebformDialogFormTrait::isAjax protected function Returns if webform is using Ajax. Overrides WebformAjaxFormTrait::isAjax 1
WebformDialogFormTrait::noSubmit public function Empty submit callback used to only have the submit button to use an #ajax submit callback. Overrides WebformAjaxFormTrait::noSubmit
WebformDialogFormTrait::noValidate public function Validate callback to clear validation errors. 2
WebformSubmissionForm::$aliasManager protected property The path alias manager.
WebformSubmissionForm::$bubbleableMetadata protected property Bubbleable metadata.
WebformSubmissionForm::$conditionsValidator protected property The webform submission conditions (#states) validator.
WebformSubmissionForm::$configFactory protected property The configuration object factory. Overrides FormBase::$configFactory
WebformSubmissionForm::$elementManager protected property The webform element plugin manager.
WebformSubmissionForm::$entity protected property The webform submission. Overrides ContentEntityForm::$entity
WebformSubmissionForm::$entityFieldManager protected property The entity field manager.
WebformSubmissionForm::$formBuilder protected property The form builder.
WebformSubmissionForm::$generate protected property The webform submission generation service.
WebformSubmissionForm::$killSwitch protected property The kill switch.
WebformSubmissionForm::$messageManager protected property The webform message manager.
WebformSubmissionForm::$originalData protected property Stores the original submission data passed via the EntityFormBuilder.
WebformSubmissionForm::$pathValidator protected property The path validator.
WebformSubmissionForm::$renderer protected property The renderer service.
WebformSubmissionForm::$requestHandler protected property The webform request handler.
WebformSubmissionForm::$selectionManager protected property The selection plugin manager.
WebformSubmissionForm::$sourceEntity protected property The source entity.
WebformSubmissionForm::$statesPrefix protected property States API prefix.
WebformSubmissionForm::$thirdPartySettingsManager protected property The webform third party settings manager.
WebformSubmissionForm::$tokenManager protected property The webform token manager.
WebformSubmissionForm::$webformEntityReferenceManager protected property The webform entity reference manager.
WebformSubmissionForm::actions protected function Returns an array of supported actions for the current entity form. Overrides EntityForm::actions
WebformSubmissionForm::actionsElement protected function Returns the action form element for the current entity form. Overrides EntityForm::actionsElement
WebformSubmissionForm::addStatesPrefix protected function Add unique class prefix to all :input #states selectors.
WebformSubmissionForm::afterBuild public function Form element #after_build callback: Updates the entity with submitted data. Overrides EntityForm::afterBuild
WebformSubmissionForm::alterElementsForm protected function Alter webform elements form.
WebformSubmissionForm::attachBehaviors protected function Attach behaviors with libraries to the form.
WebformSubmissionForm::attachLibraries protected function Attach libraries to the form.
WebformSubmissionForm::autosave public function Webform submission handler to autosave when there are validation errors.
WebformSubmissionForm::buildEntity public function Builds an updated entity object based upon the submitted form values. Overrides ContentEntityForm::buildEntity
WebformSubmissionForm::checkPrepopulateDataValid protected function Determine if element prepopulate data is valid.
WebformSubmissionForm::checkTotalLimit protected function Check webform submission total limits.
WebformSubmissionForm::checkUserLimit protected function Check webform submission user limit.
WebformSubmissionForm::complete public function Webform submission handler for the 'complete' action.
WebformSubmissionForm::confirmForm public function Webform confirm(ation) handler.
WebformSubmissionForm::copyFormValuesToEntity public function Copies top-level form values to entity properties Overrides ContentEntityForm::copyFormValuesToEntity
WebformSubmissionForm::create public static function Instantiates a new instance of this class. Overrides ContentEntityForm::create
WebformSubmissionForm::displayCurrentPage protected function Set webform wizard current page.
WebformSubmissionForm::displayMessages protected function Display draft, previous submission, and autofill status messages for this webform submission.
WebformSubmissionForm::draft public function Webform submission handler for the 'draft' action.
WebformSubmissionForm::draftEnabled protected function Determine if drafts are enabled.
WebformSubmissionForm::form public function Gets the actual form array to be built. Overrides ContentEntityForm::form
WebformSubmissionForm::getBaseFormId public function Returns a string identifying the base form. Overrides EntityForm::getBaseFormId
WebformSubmissionForm::getCurrentPage protected function Get the current page's key.
WebformSubmissionForm::getCustomForm protected function Get custom webform which is displayed instead of the webform's elements.
WebformSubmissionForm::getFirstPage protected function Get first page's key.
WebformSubmissionForm::getFormId public function Returns a unique string identifying the form. Overrides EntityForm::getFormId
WebformSubmissionForm::getLastPage protected function Get last page's key.
WebformSubmissionForm::getLastSubmission Deprecated protected function Get last completed webform submission for the current user.
WebformSubmissionForm::getLimitSourceEntity protected function Get source entity for use with entity limit total and user submissions.
WebformSubmissionForm::getMessageManager protected function Get the message manager.
WebformSubmissionForm::getNextPage protected function Get next page's key.
WebformSubmissionForm::getPages protected function Get visible wizard pages.
WebformSubmissionForm::getPreviousPage protected function Get previous page's key.
WebformSubmissionForm::getSourceEntity protected function Get the webform submission's source entity.
WebformSubmissionForm::getStorage protected function Get the webform submission entity storage.
WebformSubmissionForm::getUploadedManagedFileIds protected function Get uploaded managed file ids.
WebformSubmissionForm::getWebform public function Get the webform submission's webform.
WebformSubmissionForm::getWebformSetting protected function Get a webform submission's webform setting.
WebformSubmissionForm::gotoPage public function Webform submission handler for the 'goto' action.
WebformSubmissionForm::hasPages protected function Determine if this is a multi-step wizard form.
WebformSubmissionForm::init protected function Initializes the form state and the entity before the first form build. Overrides ContentEntityForm::init
WebformSubmissionForm::isConfidential protected function Returns the webform confidential indicator.
WebformSubmissionForm::isFormNoValidate protected function Is client side validation disabled (using the webform novalidate attribute).
WebformSubmissionForm::isGet protected function Is the webform being initially loaded via GET method.
WebformSubmissionForm::isOpen public static function Programmatically check that a webform is open to new submissions.
WebformSubmissionForm::isRoute protected function Determine if the current request is a specific route (name).
WebformSubmissionForm::isSharePage protected function Determine if the submission form is being embedded in a share page.
WebformSubmissionForm::isWebformEntityReferenceFromSourceEntity protected function Is the current webform an entity reference from the source entity.
WebformSubmissionForm::next public function Webform submission handler for the 'next' action.
WebformSubmissionForm::overrideSettings protected function Override webform settings for the webform submission.
WebformSubmissionForm::pagesElement protected function Returns the wizard page submit buttons for the current entity form.
WebformSubmissionForm::populateElements protected function Populate webform elements.
WebformSubmissionForm::prepareElements protected function Prepare webform elements.
WebformSubmissionForm::prepopulateData protected function Prepopulate element data.
WebformSubmissionForm::previous public function Webform submission handler for the 'previous' action.
WebformSubmissionForm::rebuild public function Webform submission handler for the 'rebuild' action.
WebformSubmissionForm::removeConfirmationModal public static function Hide confirmation modal during form validation.
WebformSubmissionForm::reset public function Webform submission handler for the 'reset' action.
WebformSubmissionForm::resetEnabled protected function Determine if reset is enabled.
WebformSubmissionForm::save public function Form submission handler for the 'save' action. Overrides EntityForm::save
WebformSubmissionForm::setConfirmation protected function Set webform state confirmation redirect and message. 1
WebformSubmissionForm::setEntity public function This is the best place to override an entity form's default settings because it is called immediately after the form object is initialized. Overrides EntityForm::setEntity
WebformSubmissionForm::setFormPropertiesFromElements protected function Set the webform properties from the elements.
WebformSubmissionForm::setTrustedRedirectUrl protected function Set webform state to redirect to a trusted redirect response.
WebformSubmissionForm::submit public function Webform submission handler for the 'submit' action.
WebformSubmissionForm::submitForm public function This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state… Overrides ContentEntityForm::submitForm
WebformSubmissionForm::submitFormValues public static function Programmatically validate form values and submit a webform submission.
WebformSubmissionForm::submitWebformSubmission public static function Programmatically validate and submit a webform submission.
WebformSubmissionForm::validateFormValues public static function Programmatically validate form values and submit a webform submission.
WebformSubmissionForm::validateUploadedManagedFiles protected function Validate uploaded managed file limits.
WebformSubmissionForm::validateWebformSubmission public static function Programmatically validate and submit a webform submission.
WebformSubmissionForm::wizardSubmit protected function Webform submission handler for the wizard submit action.
WebformSubmissionForm::__construct public function Constructs a WebformSubmissionForm object. Overrides ContentEntityForm::__construct
WebformTemplatesSubmissionPreviewForm::buildForm public function Form constructor. Overrides WebformSubmissionForm::buildForm
WebformTemplatesSubmissionPreviewForm::validateForm public function Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level… Overrides WebformSubmissionForm::validateForm