function EntityFormDisplay::getRenderer

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php \Drupal\Core\Entity\Entity\EntityFormDisplay::getRenderer()
  2. 10 core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php \Drupal\Core\Entity\Entity\EntityFormDisplay::getRenderer()
  3. 11.x core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php \Drupal\Core\Entity\Entity\EntityFormDisplay::getRenderer()

Overrides EntityDisplayInterface::getRenderer

3 calls to EntityFormDisplay::getRenderer()
EntityFormDisplay::buildForm in core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
Adds field widgets to an entity form.
EntityFormDisplay::extractFormValues in core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
Extracts field values from the submitted widget values into the entity.
EntityFormDisplay::flagWidgetsErrorsFromViolations in core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php
Flags entity validation violations as form errors.

File

core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php, line 147

Class

EntityFormDisplay
Configuration entity.

Namespace

Drupal\Core\Entity\Entity

Code

public function getRenderer($field_name) {
    if (isset($this->plugins[$field_name])) {
        return $this->plugins[$field_name];
    }
    // Instantiate the widget object from the stored display properties.
    if (($configuration = $this->getComponent($field_name)) && isset($configuration['type']) && ($definition = $this->getFieldDefinition($field_name))) {
        $widget = $this->pluginManager
            ->getInstance([
            'field_definition' => $definition,
            'form_mode' => $this->originalMode,
            // No need to prepare, defaults have been merged in setComponent().
'prepare' => FALSE,
            'configuration' => $configuration,
        ]);
    }
    else {
        $widget = NULL;
    }
    // Persist the widget object.
    $this->plugins[$field_name] = $widget;
    return $widget;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.