class WebformTemplatesSubmissionPreviewForm in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_templates/src/WebformTemplatesSubmissionPreviewForm.php \Drupal\webform_templates\WebformTemplatesSubmissionPreviewForm
Preview webform submission webform.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\webform\WebformSubmissionForm uses WebformDialogFormTrait
- class \Drupal\webform_templates\WebformTemplatesSubmissionPreviewForm uses WebformDialogFormTrait
- class \Drupal\webform\WebformSubmissionForm uses WebformDialogFormTrait
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of WebformTemplatesSubmissionPreviewForm
File
- modules/
webform_templates/ src/ WebformTemplatesSubmissionPreviewForm.php, line 14
Namespace
Drupal\webform_templatesView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityForm:: |
protected | property | The entity repository service. | |
ContentEntityForm:: |
protected | property | The entity type bundle info service. | |
ContentEntityForm:: |
protected | property | The time service. | |
ContentEntityForm:: |
protected | function | Add revision form fields if the entity enabled the UI. | |
ContentEntityForm:: |
protected | function | Flags violations for the current form. | 4 |
ContentEntityForm:: |
protected | function | Returns the bundle entity of the entity, or NULL if there is none. | |
ContentEntityForm:: |
protected | function | Gets the names of all fields edited in the form. | 4 |
ContentEntityForm:: |
public | function |
Gets the form display. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
public | function |
Gets the code identifying the active form language. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function | Should new revisions created on default. | |
ContentEntityForm:: |
protected | function | Initializes form language code values. | |
ContentEntityForm:: |
public | function |
Checks whether the current form language matches the entity one. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function |
Prepares the entity object before the form is built first. Overrides EntityForm:: |
1 |
ContentEntityForm:: |
public | function |
Sets the form display. Overrides ContentEntityFormInterface:: |
|
ContentEntityForm:: |
protected | function | Checks whether the revision form fields should be added to the form. | |
ContentEntityForm:: |
public | function | Updates the changed time of the entity. | |
ContentEntityForm:: |
public | function | Updates the form language to reflect any change to the entity language. | |
ContentEntityForm:: |
public | function | Constructs a ContentEntityForm object. | 9 |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
EntityForm:: |
protected | property | The entity type manager. | 3 |
EntityForm:: |
protected | property | The module handler service. | |
EntityForm:: |
protected | property | The name of the current operation. | |
EntityForm:: |
public | function |
Gets the form entity. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface:: |
3 |
EntityForm:: |
public | function |
Gets the operation identifying the form. Overrides EntityFormInterface:: |
|
EntityForm:: |
protected | function | Invokes the specified prepare hook variant. | |
EntityForm:: |
public | function | Process callback: assigns weights and hides extra fields. | |
EntityForm:: |
public | function |
Sets the entity type manager for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the module handler for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the operation for this form. Overrides EntityFormInterface:: |
|
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
WebformAjaxFormTrait:: |
protected | function | Queue announcement with Ajax response. | |
WebformAjaxFormTrait:: |
protected | function | Add Ajax support to a form. | |
WebformAjaxFormTrait:: |
protected | function | Create an AjaxResponse or WebformAjaxResponse object. | |
WebformAjaxFormTrait:: |
protected | function | Get announcements. | |
WebformAjaxFormTrait:: |
protected | function | Get default ajax callback settings. | 1 |
WebformAjaxFormTrait:: |
protected | function | Get redirect URL from the form's state. | |
WebformAjaxFormTrait:: |
protected | function | Get the form's Ajax wrapper id. | 1 |
WebformAjaxFormTrait:: |
protected | function | Determine if Ajax callback is callable. | |
WebformAjaxFormTrait:: |
protected | function | Is the current request for an Ajax modal/dialog. | |
WebformAjaxFormTrait:: |
protected | function | Is the current request for an off canvas dialog. | |
WebformAjaxFormTrait:: |
protected | function | Handle missing Ajax callback. | |
WebformAjaxFormTrait:: |
protected | function | Replace form via an Ajax response. | 1 |
WebformAjaxFormTrait:: |
protected | function | Reset announcements. | |
WebformAjaxFormTrait:: |
protected | function | Set announcements. | |
WebformAjaxFormTrait:: |
public | function | Submit form #ajax callback. | 1 |
WebformAjaxFormTrait:: |
public | function | Validate form #ajax callback. | 1 |
WebformDialogFormTrait:: |
protected | function | Add modal dialog support to a confirm form. | |
WebformDialogFormTrait:: |
protected | function | Build webform dialog delete link. | |
WebformDialogFormTrait:: |
protected | function | Add modal dialog support to a form. | |
WebformDialogFormTrait:: |
public | function |
Cancel form #ajax callback. Overrides WebformAjaxFormTrait:: |
1 |
WebformDialogFormTrait:: |
public | function | Close dialog. | |
WebformDialogFormTrait:: |
protected | function |
Returns if webform is using Ajax. Overrides WebformAjaxFormTrait:: |
1 |
WebformDialogFormTrait:: |
public | function |
Empty submit callback used to only have the submit button to use an #ajax submit callback. Overrides WebformAjaxFormTrait:: |
|
WebformDialogFormTrait:: |
public | function | Validate callback to clear validation errors. | 2 |
WebformSubmissionForm:: |
protected | property | The path alias manager. | |
WebformSubmissionForm:: |
protected | property | Bubbleable metadata. | |
WebformSubmissionForm:: |
protected | property | The webform submission conditions (#states) validator. | |
WebformSubmissionForm:: |
protected | property |
The configuration object factory. Overrides FormBase:: |
|
WebformSubmissionForm:: |
protected | property | The webform element plugin manager. | |
WebformSubmissionForm:: |
protected | property |
The webform submission. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
protected | property | The entity field manager. | |
WebformSubmissionForm:: |
protected | property | The form builder. | |
WebformSubmissionForm:: |
protected | property | The webform submission generation service. | |
WebformSubmissionForm:: |
protected | property | The kill switch. | |
WebformSubmissionForm:: |
protected | property | The webform message manager. | |
WebformSubmissionForm:: |
protected | property | Stores the original submission data passed via the EntityFormBuilder. | |
WebformSubmissionForm:: |
protected | property | The path validator service. | |
WebformSubmissionForm:: |
protected | property | The renderer service. | |
WebformSubmissionForm:: |
protected | property | The webform request handler. | |
WebformSubmissionForm:: |
protected | property | The selection plugin manager service. | |
WebformSubmissionForm:: |
protected | property | The source entity. | |
WebformSubmissionForm:: |
protected | property | States API prefix. | |
WebformSubmissionForm:: |
protected | property | The webform third party settings manager. | |
WebformSubmissionForm:: |
protected | property | The webform token manager. | |
WebformSubmissionForm:: |
protected | property | The webform entity reference manager. | |
WebformSubmissionForm:: |
protected | function |
Returns an array of supported actions for the current entity form. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function |
Returns the action form element for the current entity form. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Add cache dependency to the form's render array. | |
WebformSubmissionForm:: |
protected | function | Add unique class prefix to all :input #states selectors. | |
WebformSubmissionForm:: |
public | function |
Form element #after_build callback: Updates the entity with submitted data. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Alter webform elements form. | |
WebformSubmissionForm:: |
protected | function | Attach behaviors with libraries to the form. | |
WebformSubmissionForm:: |
protected | function | Attach libraries to the form. | |
WebformSubmissionForm:: |
public | function | Webform submission handler to autosave when there are validation errors. | |
WebformSubmissionForm:: |
public | function |
Builds an updated entity object based upon the submitted form values. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Determine if element prepopulate data is valid. | |
WebformSubmissionForm:: |
protected | function | Check webform submission total limits. | |
WebformSubmissionForm:: |
protected | function | Check webform submission user limit. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'complete' action. | |
WebformSubmissionForm:: |
public | function | Webform confirm(ation) handler. | |
WebformSubmissionForm:: |
public | function |
Copies top-level form values to entity properties. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
public static | function |
Instantiates a new instance of this class. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Set webform wizard current page. | |
WebformSubmissionForm:: |
protected | function | Display draft, previous submission, and autofill status messages for this webform submission. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'draft' action. | |
WebformSubmissionForm:: |
protected | function | Determine if drafts are enabled. | |
WebformSubmissionForm:: |
public | function |
Gets the actual form array to be built. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
public | function |
Returns a string identifying the base form. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Get the webform's confrmation URL. | |
WebformSubmissionForm:: |
protected | function | Get the current page's key. | |
WebformSubmissionForm:: |
protected | function | Get custom webform which is displayed instead of the webform's elements. | |
WebformSubmissionForm:: |
protected | function | Get first page's key. | |
WebformSubmissionForm:: |
public | function |
Returns a unique string identifying the form. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Get last page's key. | |
WebformSubmissionForm:: |
protected | function | Get source entity for use with entity limit total and user submissions. | |
WebformSubmissionForm:: |
protected | function | Get the message manager. | |
WebformSubmissionForm:: |
protected | function | Get next page's key. | |
WebformSubmissionForm:: |
protected | function | Get visible wizard pages. | |
WebformSubmissionForm:: |
protected | function | Get previous page's key. | |
WebformSubmissionForm:: |
protected | function | Get the webform submission's source entity. | |
WebformSubmissionForm:: |
protected | function | Get the webform submission entity storage. | |
WebformSubmissionForm:: |
protected | function | Get uploaded managed file ids. | |
WebformSubmissionForm:: |
public | function | Get the webform submission's webform. | |
WebformSubmissionForm:: |
protected | function | Get a webform submission's webform setting. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'goto' action. | |
WebformSubmissionForm:: |
protected | function | Determine if this is a multi-step wizard form. | |
WebformSubmissionForm:: |
protected | function |
Initializes the form state and the entity before the first form build. Overrides ContentEntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Returns the webform confidential indicator. | |
WebformSubmissionForm:: |
protected | function | Is client side validation disabled (using the webform novalidate attribute). | |
WebformSubmissionForm:: |
protected | function | Is the webform being initially loaded via GET method. | |
WebformSubmissionForm:: |
public static | function | Programmatically check that a webform is open to new submissions. | |
WebformSubmissionForm:: |
protected | function | Determine if the current request is a specific route (name). | |
WebformSubmissionForm:: |
protected | function | Determine if the submission form is being embedded in a share page. | |
WebformSubmissionForm:: |
protected | function | Is the current webform an entity reference from the source entity. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'next' action. | |
WebformSubmissionForm:: |
protected | function | Override webform settings for the webform submission. | |
WebformSubmissionForm:: |
protected | function | Returns the wizard page submit buttons for the current entity form. | |
WebformSubmissionForm:: |
protected | function | Populate webform elements. | |
WebformSubmissionForm:: |
protected | function | Prepare webform elements. | |
WebformSubmissionForm:: |
protected | function | Prepopulate element data. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'previous' action. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'rebuild' action. | |
WebformSubmissionForm:: |
public static | function | Hide confirmation modal during form validation. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'reset' action. | |
WebformSubmissionForm:: |
protected | function | Determine if reset is enabled. | |
WebformSubmissionForm:: |
public | function |
Form submission handler for the 'save' action. Overrides EntityForm:: |
|
WebformSubmissionForm:: |
protected | function | Set webform state confirmation redirect and message. | 1 |
WebformSubmissionForm:: |
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:: |
|
WebformSubmissionForm:: |
protected | function | Set the webform properties from the elements. | |
WebformSubmissionForm:: |
protected | function | Set webform state to redirect to a trusted redirect response. | |
WebformSubmissionForm:: |
public | function | Webform submission handler for the 'submit' action. | |
WebformSubmissionForm:: |
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:: |
|
WebformSubmissionForm:: |
public static | function | Programmatically validate form values and submit a webform submission. | |
WebformSubmissionForm:: |
public static | function | Programmatically validate and submit a webform submission. | |
WebformSubmissionForm:: |
public static | function | Programmatically validate form values and submit a webform submission. | |
WebformSubmissionForm:: |
protected | function | Validate uploaded managed file limits. | |
WebformSubmissionForm:: |
public static | function | Programmatically validate and submit a webform submission. | |
WebformSubmissionForm:: |
protected | function | Webform submission handler for the wizard submit action. | |
WebformTemplatesSubmissionPreviewForm:: |
public | function |
Form constructor. Overrides WebformSubmissionForm:: |
|
WebformTemplatesSubmissionPreviewForm:: |
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:: |