public EntityFormDisplay::getRenderer($field_name)
Gets the renderer plugin for a field (e.g. widget, formatter).
string $field_name: The field name.
\Drupal\Core\Field\PluginSettingsInterface|null A widget or formatter plugin or NULL if the field does not exist.
Overrides EntityDisplayInterface::getRenderer
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(array( '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; }
© 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::getRenderer/8.1.x