Overrides EntityFormController::form().
Overrides EntityFormController::form
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;
}