You are here

public function FlexiformController::formModePage in Flexiform 8

Flexiform form mode page.

File

src/Controller/FlexiformController.php, line 72

Class

FlexiformController
Controller for flexiform pages.

Namespace

Drupal\flexiform\Controller

Code

public function formModePage(EntityFormMode $form_mode, Request $request) {
  $provided = $this
    ->getProvidedEntities($form_mode, $request);
  $entity = $provided['base_entity'];
  unset($provided['base_entity']);
  $settings = $form_mode
    ->getThirdPartySetting('flexiform', 'exposure');
  list($entity_type_id, $display_mode_name) = explode('.', $form_mode
    ->id(), 2);
  $entity_form_display = EntityFormDisplay::collectRenderDisplay($entity, $display_mode_name);
  $form_object = $this->flexiformManager
    ->getFormObject($entity_form_display, [
    $entity_form_display
      ->getBaseEntityNamespace() => $entity,
  ]);
  $form_state = new FormState();
  $form_state
    ->set('form_entity_provided', $provided);
  return $this->formBuilder
    ->buildForm($form_object, $form_state);
}