public function FormConverterFactory::get in Drupal 7 to 8/9 Module Upgrader 8
Creates a FormConverter for a specific form.
Parameters
\Drupal\drupalmoduleupgrader\TargetInterface $target: The module which defines the form.
string $form_id: The original form ID.
Return value
Throws
\BadMethodCallException if the target module doesn't define the given form.
File
- src/
Utility/ FormConverterFactory.php, line 37
Class
Namespace
Drupal\drupalmoduleupgrader\UtilityCode
public function get(TargetInterface $target, $form_id) {
$indexer = $target
->getIndexer('function');
if ($indexer
->has($form_id)) {
return new FormConverter($target, $form_id, $this->rewriter);
}
else {
$message = $this
->t('@target does not define form @form_id.', [
'@target' => $target
->id(),
'@form_id' => $form_id,
]);
throw new \BadMethodCallException($message);
}
}