Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityField.php

function EntityField::getFormatterInstance

Returns the field formatter instance.

Return value

\Drupal\Core\Field\FormatterInterface|null The field formatter instance.

2 calls to EntityField::getFormatterInstance()
EntityField::buildOptionsForm in core/modules/views/src/Plugin/views/field/EntityField.php
Default option form that provides label widget that all fields should have.
EntityField::calculateDependencies in core/modules/views/src/Plugin/views/field/EntityField.php
Calculates dependencies for the configured plugin.

File

core/modules/views/src/Plugin/views/field/EntityField.php, line 1021

Class

EntityField
A field that displays entity field data.

Namespace

Drupal\views\Plugin\views\field

Code

protected function getFormatterInstance($format = NULL) {
    if (!isset($format)) {
        $format = $this->options['type'];
    }
    $settings = $this->options['settings'] + $this->formatterPluginManager
        ->getDefaultSettings($format);
    $options = [
        'field_definition' => $this->getFieldDefinition(),
        'configuration' => [
            'type' => $format,
            'settings' => $settings,
            'label' => '',
            'weight' => 0,
        ],
        'view_mode' => '_custom',
    ];
    return $this->formatterPluginManager
        ->getInstance($options);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal