public function EntityFormControllerNG::form

Overrides EntityFormController::form().

Overrides EntityFormController::form

1 call to EntityFormControllerNG::form()
EntityTestFormController::form in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
1 method overrides EntityFormControllerNG::form()
EntityTestFormController::form in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().

File

drupal/core/lib/Drupal/Core/Entity/EntityFormControllerNG.php, line 21
Definition of Drupal\Core\Entity\EntityFormControllerNG.

Class

EntityFormControllerNG
Entity form controller variant for entity types using the new property API.

Namespace

Drupal\Core\Entity

Code

public function form(array $form, array &$form_state, EntityInterface $entity) {

  // @todo Exploit the Field API to generate the default widgets for the
  // entity properties.
  $info = $entity
    ->entityInfo();
  if (!empty($info['fieldable'])) {
    $entity
      ->setCompatibilityMode(TRUE);
    field_attach_form($entity
      ->entityType(), $entity, $form, $form_state, $this
      ->getFormLangcode($form_state));
    $entity
      ->setCompatibilityMode(FALSE);
  }
  return $form;
}