public function EntityFormControllerNG::form

Overrides EntityFormController::form().

Overrides EntityFormController::form

5 calls to EntityFormControllerNG::form()
CommentFormController::form in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
CustomBlockFormController::form in drupal/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
Overrides \Drupal\Core\Entity\EntityFormController::form().
EntityTestFormController::form in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
FeedFormController::form in drupal/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
TermFormController::form in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
5 methods override EntityFormControllerNG::form()
CommentFormController::form in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
CustomBlockFormController::form in drupal/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
Overrides \Drupal\Core\Entity\EntityFormController::form().
EntityTestFormController::form in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
FeedFormController::form in drupal/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
TermFormController::form in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().

File

drupal/core/lib/Drupal/Core/Entity/EntityFormControllerNG.php, line 25
Contains \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) {
  $entity = $this->entity;

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

  // Assign the weights configured in the form display.
  foreach ($this
    ->getFormDisplay($form_state)
    ->getComponents() as $name => $options) {
    if (isset($form[$name])) {
      $form[$name]['#weight'] = $options['weight'];
    }
  }
  return $form;
}