class YamlFormTemplatesSubmissionPreviewForm in YAML Form 8
Preview form submission form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\yamlform\YamlFormSubmissionForm uses YamlFormDialogTrait
- class \Drupal\yamlform_templates\YamlFormTemplatesSubmissionPreviewForm uses YamlFormDialogTrait
- class \Drupal\yamlform\YamlFormSubmissionForm uses YamlFormDialogTrait
- class \Drupal\Core\Entity\ContentEntityForm implements ContentEntityFormInterface
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of YamlFormTemplatesSubmissionPreviewForm
File
- modules/
yamlform_templates/ src/ YamlFormTemplatesSubmissionPreviewForm.php, line 16
Namespace
Drupal\yamlform_templatesView source
class YamlFormTemplatesSubmissionPreviewForm extends YamlFormSubmissionForm {
use YamlFormDialogTrait;
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
if ($this
->isModalDialog()) {
// Disable validation.
$form['#attributes']['novalidate'] = 'novalidate';
// Display form title in modal.
$form['title'] = [
'#markup' => $this
->getYamlForm()
->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.yamlform.duplicate_form', [
'yamlform' => $this
->getYamlForm()
->id(),
]),
'#attributes' => YamlFormDialogHelper::getModalDialogAttributes(640, [
'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
->isModalDialog()) {
$form_state
->clearErrors();
}
else {
parent::validateForm($form, $form_state);
}
}
/**
* Close dialog.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return bool|\Drupal\Core\Ajax\AjaxResponse
* An AJAX response that display validation error messages.
*/
public function closeDialog(array &$form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response
->addCommand(new CloseDialogCommand());
return $response;
}
}
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:: |
public | function |
Builds an updated entity object based upon the submitted form values. Overrides EntityForm:: |
3 |
ContentEntityForm:: |
protected | function |
Copies top-level form values to entity properties Overrides EntityForm:: |
|
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 the form state and the entity before the first form build. Overrides EntityForm:: |
1 |
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. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
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:: |
private | property | The entity manager. | |
EntityForm:: |
public | function |
Returns a string identifying the base form. Overrides BaseFormIdInterface:: |
5 |
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:: |
1 |
EntityForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
10 |
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 manager for this form. Overrides EntityFormInterface:: |
|
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:: |
|
EntityForm:: |
public | function | ||
EntityForm:: |
public | function | ||
FormBase:: |
protected | property | The config factory. | 1 |
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. | 1 |
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. Overrides UrlGeneratorTrait:: |
|
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. | |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
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. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
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. | 1 |
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. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. | |
YamlFormDialogTrait:: |
protected | function | Add modal dialog support to a form. | |
YamlFormDialogTrait:: |
protected | function | Is the current request for an AJAX modal dialog. | |
YamlFormDialogTrait:: |
protected | function | Handler dialog redirect after form is submitted. | |
YamlFormDialogTrait:: |
protected | function | Display validation error messages in modal dialog. | |
YamlFormSubmissionForm:: |
protected | property | The form element (plugin) manager. | |
YamlFormSubmissionForm:: |
protected | property |
The form submission. Overrides ContentEntityForm:: |
|
YamlFormSubmissionForm:: |
protected | property | The form message manager. | |
YamlFormSubmissionForm:: |
protected | property | Form request handler. | |
YamlFormSubmissionForm:: |
protected | property | The form settings. | |
YamlFormSubmissionForm:: |
protected | property | The source entity. | |
YamlFormSubmissionForm:: |
protected | property | The form submission storage. | |
YamlFormSubmissionForm:: |
protected | property | The form third party settings manager. | |
YamlFormSubmissionForm:: |
protected | property | The token manager. | |
YamlFormSubmissionForm:: |
protected | function |
Returns an array of supported actions for the current entity form. Overrides EntityForm:: |
|
YamlFormSubmissionForm:: |
protected | function |
Returns the action form element for the current entity form. Overrides EntityForm:: |
|
YamlFormSubmissionForm:: |
public | function |
Form element #after_build callback: Updates the entity with submitted data. Overrides EntityForm:: |
|
YamlFormSubmissionForm:: |
public | function | Form submission handler to autosave when there are validation errors. | |
YamlFormSubmissionForm:: |
protected | function | Check form submission total limits. | |
YamlFormSubmissionForm:: |
protected | function | Check form submission user limit. | |
YamlFormSubmissionForm:: |
public | function | Form submission handler for the 'complete' action. | |
YamlFormSubmissionForm:: |
public | function | Form confirm(ation) handler. | |
YamlFormSubmissionForm:: |
public static | function |
Instantiates a new instance of this class. Overrides ContentEntityForm:: |
|
YamlFormSubmissionForm:: |
protected | function | Set form wizard current page. | |
YamlFormSubmissionForm:: |
protected | function | Display draft and previous submission status messages for this form submission. | |
YamlFormSubmissionForm:: |
public | function | Form submission handler for the 'draft' action. | |
YamlFormSubmissionForm:: |
protected | function | Determine if drafts are enabled. | |
YamlFormSubmissionForm:: |
public | function |
Gets the actual form array to be built. Overrides ContentEntityForm:: |
|
YamlFormSubmissionForm:: |
protected | function | Get the current page's key. | |
YamlFormSubmissionForm:: |
protected | function | Get custom form which is displayed instead of the form's elements. | |
YamlFormSubmissionForm:: |
protected | function | Get first page's key. | |
YamlFormSubmissionForm:: |
protected | function | Get last page's key. | |
YamlFormSubmissionForm:: |
protected | function | Get source entity for use with entity limit total and user submissions. | |
YamlFormSubmissionForm:: |
protected | function | Get next page's key. | |
YamlFormSubmissionForm:: |
protected | function | Get visible wizard pages. | |
YamlFormSubmissionForm:: |
protected | function | Get previous page's key. | |
YamlFormSubmissionForm:: |
protected | function | Get the form submission's source entity. | |
YamlFormSubmissionForm:: |
protected | function | Get the form submission's form. | |
YamlFormSubmissionForm:: |
protected | function | Get a form submission's form setting. | |
YamlFormSubmissionForm:: |
public static | function | Form element #after_build callback: Wrap #element_validate so that we suppress element validation errors. | |
YamlFormSubmissionForm:: |
public static | function | Form element #element_validate callback: Execute #element_validate and suppress errors. | |
YamlFormSubmissionForm:: |
protected | function | Hide form elements by settings their #access to FALSE. | |
YamlFormSubmissionForm:: |
protected | function | Returns the form confidential indicator. | |
YamlFormSubmissionForm:: |
protected | function | Is client side validation disabled (using the form novalidate attribute). | |
YamlFormSubmissionForm:: |
protected | function | Is the form being initially loaded via GET method. | |
YamlFormSubmissionForm:: |
protected | function | Determine if the current request is a specific route (name). | |
YamlFormSubmissionForm:: |
protected | function | Is the current form an entity reference from the source entity. | |
YamlFormSubmissionForm:: |
public | function | Form submission handler for the 'next' action. | |
YamlFormSubmissionForm:: |
public | function | Form submission validation that does nothing but clear validation errors. | |
YamlFormSubmissionForm:: |
protected | function | Populate form elements. | |
YamlFormSubmissionForm:: |
protected | function | Prepare form elements. | |
YamlFormSubmissionForm:: |
protected | function | Prepopulate element data. | |
YamlFormSubmissionForm:: |
public | function | Form submission handler for the 'previous' action. | |
YamlFormSubmissionForm:: |
public | function | Form submission handler for the 'rebuild' action. | |
YamlFormSubmissionForm:: |
public | function |
Form submission handler for the 'save' action. Overrides EntityForm:: |
|
YamlFormSubmissionForm:: |
protected | function | Set form state confirmation redirect and message. | |
YamlFormSubmissionForm:: |
public | function |
Sets the form entity. Overrides EntityForm:: |
|
YamlFormSubmissionForm:: |
protected | function | Set the form properties from the elements. | |
YamlFormSubmissionForm:: |
protected | function | Set form state to redirect to a trusted redirect response. | |
YamlFormSubmissionForm:: |
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:: |
|
YamlFormSubmissionForm:: |
protected | function | Form submission handler for the wizard submit action. | |
YamlFormSubmissionForm:: |
public | function |
Constructs a YamlFormSubmissionForm object. Overrides ContentEntityForm:: |
|
YamlFormTemplatesSubmissionPreviewForm:: |
public | function |
Form constructor. Overrides YamlFormSubmissionForm:: |
|
YamlFormTemplatesSubmissionPreviewForm:: |
public | function | Close dialog. | |
YamlFormTemplatesSubmissionPreviewForm:: |
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 YamlFormSubmissionForm:: |