Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/ExecutePHP.php, line 51

Class

ExecutePHP
Defines a form that allows privileged users to execute arbitrary PHP code.

Namespace

Drupal\devel\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  ob_start();
  $code = $form_state
    ->getValue('code');
  print eval($code);
  $_SESSION['devel_execute_code'] = $code;
  dpm(ob_get_clean());
}