You are here

public function FormConverter::render in Drupal 7 to 8/9 Module Upgrader 8

Return value

\Pharborist\Objects\ClassNode

1 call to FormConverter::render()
FormConverter::build in src/Utility/FormConverter.php

File

src/Utility/FormConverter.php, line 89

Class

FormConverter
Converts a form from a set of callback functions to a class implementing \Drupal\Core\Form\FormInterface.

Namespace

Drupal\drupalmoduleupgrader\Utility

Code

public function render() {
  if (empty($this->controller)) {
    $render = [
      '#theme' => 'dmu_form',
      '#module' => $this->target
        ->id(),
      '#form_id' => $this->formID,
      '#class' => $this
        ->toTitleCase($this->formID),
      '#config' => $this->isConfig,
    ];
    $source = \Drupal::service('renderer')
      ->renderPlain($render);
    $this->controller = Parser::parseSource($source)
      ->find(Filter::isClass($render['#class']))
      ->get(0);
  }
  return $this->controller;
}