public EntityFormDisplay::processForm($element, FormStateInterface $form_state, $form)
Process callback: assigns weights and hides extra fields.
\Drupal\Core\Entity\Entity\EntityFormDisplay::buildForm()
public function processForm($element, FormStateInterface $form_state, $form) { // Assign the weights configured in the form display. foreach ($this->getComponents() as $name => $options) { if (isset($element[$name])) { $element[$name]['#weight'] = $options['weight']; } } // Hide extra fields. $extra_fields = \Drupal::entityManager()->getExtraFields($this->targetEntityType, $this->bundle); $extra_fields = isset($extra_fields['form']) ? $extra_fields['form'] : array(); foreach ($extra_fields as $extra_field => $info) { if (!$this->getComponent($extra_field)) { $element[$extra_field]['#access'] = FALSE; } } return $element; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Entity!EntityFormDisplay.php/function/EntityFormDisplay::processForm/8.1.x