You are here

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

File

src/Utility/FormConverter.php, line 65

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 __construct(TargetInterface $target, $form_id, RewriterInterface $rewriter) {
  $indexer = $target
    ->getIndexer('function');
  $this->target = $target;
  $this->formID = $form_id;
  $this->builder = $indexer
    ->get($form_id);
  $validator = $form_id . '_validate';
  if ($indexer
    ->has($validator)) {
    $this->validator = $indexer
      ->get($validator);
  }
  $submit_handler = $form_id . '_submit';
  if ($indexer
    ->has($submit_handler)) {
    $this->submitHandler = $indexer
      ->get($submit_handler);
  }
  $this->isConfig = $this->builder
    ->has(Filter::isFunctionCall('system_settings_form'));
  $this->formStateRewriter = $rewriter;
}