class FormBuilderWrapper in Devel 8.3
Same name and namespace in other branches
- 8 webprofiler/src/Form/FormBuilderWrapper.php \Drupal\webprofiler\Form\FormBuilderWrapper
- 8.2 webprofiler/src/Form/FormBuilderWrapper.php \Drupal\webprofiler\Form\FormBuilderWrapper
- 4.x webprofiler/src/Form/FormBuilderWrapper.php \Drupal\webprofiler\Form\FormBuilderWrapper
Class FormBuilderWrapper.
Hierarchy
- class \Drupal\Core\Form\FormBuilder implements FormBuilderInterface, FormCacheInterface, FormSubmitterInterface, FormValidatorInterface, TrustedCallbackInterface
- class \Drupal\webprofiler\Form\FormBuilderWrapper
Expanded class hierarchy of FormBuilderWrapper
1 file declares its use of FormBuilderWrapper
- FormsDataCollector.php in webprofiler/
src/ DataCollector/ FormsDataCollector.php
File
- webprofiler/
src/ Form/ FormBuilderWrapper.php, line 11
Namespace
Drupal\webprofiler\FormView source
class FormBuilderWrapper extends FormBuilder {
/**
* @var array
*/
private $buildForms;
/**
* @return array
*/
public function getBuildForm() {
return $this->buildForms;
}
/**
* {@inheritdoc}
*/
public function prepareForm($form_id, &$form, FormStateInterface &$form_state) {
parent::prepareForm($form_id, $form, $form_state);
if (!$this->buildForms) {
$this->buildForms = [];
}
$elements = [];
foreach ($form as $key => $value) {
if (strpos($key, '#') !== 0) {
$elements[$key]['#title'] = isset($value['#title']) ? $value['#title'] : NULL;
$elements[$key]['#access'] = isset($value['#access']) ? $value['#access'] : NULL;
$elements[$key]['#type'] = isset($value['#type']) ? $value['#type'] : NULL;
}
}
$buildInfo = $form_state
->getBuildInfo();
$class = get_class($buildInfo['callback_object']);
$method = new \ReflectionMethod($class, 'buildForm');
$this->buildForms[$buildInfo['form_id']] = [
'class' => [
'class' => $class,
'method' => 'buildForm',
'file' => $method
->getFilename(),
'line' => $method
->getStartLine(),
],
'form' => $elements,
];
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormBuilder:: |
protected | property | The class resolver. | |
FormBuilder:: |
protected | property | The CSRF token generator to validate the form token. | |
FormBuilder:: |
protected | property | The current user. | |
FormBuilder:: |
protected | property | The element info manager. | |
FormBuilder:: |
protected | property | The event dispatcher. | |
FormBuilder:: |
protected | property | The form cache. | |
FormBuilder:: |
protected | property | The form submitter. | |
FormBuilder:: |
protected | property | The form validator. | |
FormBuilder:: |
protected | property | The module handler. | |
FormBuilder:: |
protected | property | The request stack. | |
FormBuilder:: |
protected | property | Defines element value callables which are safe to run even when the form state has an invalid CSRF token. | |
FormBuilder:: |
protected | property | The theme manager. | |
FormBuilder:: |
public | function |
Builds and processes a form for a given form ID. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
protected | function | Builds the $form['#action']. | |
FormBuilder:: |
protected | function | Determines if a given button triggered the form submission. | |
FormBuilder:: |
protected | function | Gets the current active user. | |
FormBuilder:: |
public | function |
Deletes a form in the cache. Overrides FormCacheInterface:: |
|
FormBuilder:: |
public | function |
Builds and processes all elements in the structured form array. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public | function |
Handles the submitted form, executing callbacks and processing responses. Overrides FormSubmitterInterface:: |
|
FormBuilder:: |
protected | function | Detects if an element triggered the form submission via Ajax. | |
FormBuilder:: |
public | function |
Executes custom submission handlers for a given form. Overrides FormSubmitterInterface:: |
|
FormBuilder:: |
public | function |
Executes custom validation handlers for a given form. Overrides FormValidatorInterface:: |
|
FormBuilder:: |
public | function |
Fetches a form from the cache. Overrides FormCacheInterface:: |
|
FormBuilder:: |
protected | function | Wraps file_upload_max_size(). | |
FormBuilder:: |
public | function |
Gets a renderable form array. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public | function |
Determines the ID of a form. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
protected | function | Adds the #name and #value properties of an input element before rendering. | |
FormBuilder:: |
public | function |
Processes a form submission. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public | function |
Constructs a new $form from the information in $form_state. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public | function |
Redirects the user to a URL after a form has been processed. Overrides FormSubmitterInterface:: |
|
FormBuilder:: |
public | function | Renders the form CSRF token. It's a #lazy_builder callback. | |
FormBuilder:: |
public | function | Renders a form action URL. It's a #lazy_builder callback. | |
FormBuilder:: |
public | function |
Retrieves the structured array that defines a given form. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public | function |
Stores a form in the cache. Overrides FormCacheInterface:: |
|
FormBuilder:: |
public | function |
Sets a form_token error on the given form state. Overrides FormValidatorInterface:: |
|
FormBuilder:: |
public | function |
Retrieves, populates, and processes a form. Overrides FormBuilderInterface:: |
|
FormBuilder:: |
public static | function |
Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface:: |
|
FormBuilder:: |
public | function |
Validates user-submitted form data in the $form_state. Overrides FormValidatorInterface:: |
|
FormBuilder:: |
protected | function | Helper function to normalize the different callable formats. | |
FormBuilder:: |
public | function | Constructs a new FormBuilder. | |
FormBuilderInterface:: |
constant | Request key for AJAX forms that submit to the form's original route. | ||
FormBuilderWrapper:: |
private | property | ||
FormBuilderWrapper:: |
public | function | ||
FormBuilderWrapper:: |
public | function |
Prepares a structured form array. Overrides FormBuilder:: |
|
TrustedCallbackInterface:: |
constant | Untrusted callbacks throw exceptions. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | ||
TrustedCallbackInterface:: |
constant | Untrusted callbacks trigger E_USER_WARNING errors. |