You are here

public function SchemaFormBuilder::getFormArray in Migrate API 8

Same name and namespace in other branches
  1. 8.2 src/SchemaFormBuilder.php \Drupal\migrate_api\SchemaFormBuilder::getFormArray()

Get a form from a schema plugin id.

Parameters

string $schema_plugin_id: The schema plugin id.

\Drupal\Core\Form\FormStateInterface $form_state: The form state the form will become a part of.

Return value

array Form elements.

Overrides SchemaFormBuilderInterface::getFormArray

File

src/SchemaFormBuilder.php, line 83
Contains \Drupal\migrate_api\SchemaFormBuilder.

Class

SchemaFormBuilder
Builds forms from schema.

Namespace

Drupal\migrate_api

Code

public function getFormArray($schema_plugin_id, FormStateInterface $form_state) {
  $this->ajaxIdMap = [];
  $plugin = $this->configManager
    ->get($schema_plugin_id);
  $form = [];
  $this
    ->processSchema($plugin
    ->getDataDefinition(), SchemaFormBuilderInterface::ROOT_CONTEXT_KEY, $form, $form_state);
  return $form[SchemaFormBuilderInterface::ROOT_CONTEXT_KEY];
}