class FormBuilderWrapper
Class FormBuilderWrapper
Hierarchy
- class \Drupal\webprofiler\Form\FormBuilderWrapper extends \Drupal\Core\Form\FormBuilder
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
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FormBuilderWrapper::$buildForms | private | property | |
FormBuilderWrapper::getBuildForm | public | function | |
FormBuilderWrapper::prepareForm | public | function |