function EntityField::getFormatter

Same name in other branches
  1. 4.0.x modules/ctools_block/src/Plugin/Block/EntityField.php \Drupal\ctools_block\Plugin\Block\EntityField::getFormatter()

Gets the formatter object.

Parameters

string $type: The formatter name.

string $label: The label option for the formatter.

array $settings: The formatter settings.

array $third_party_settings: The formatter third party settings.

Return value

\Drupal\Core\Field\FormatterInterface The formatter object.

1 call to EntityField::getFormatter()
EntityField::formatterSettingsProcessCallback in modules/ctools_block/src/Plugin/Block/EntityField.php
Render API callback: builds the formatter settings elements.

File

modules/ctools_block/src/Plugin/Block/EntityField.php, line 368

Class

EntityField
Provides a block to a field on an entity.

Namespace

Drupal\ctools_block\Plugin\Block

Code

protected function getFormatter($type, $label, array $settings, array $third_party_settings) {
    return $this->formatterManager
        ->createInstance($type, [
        'field_definition' => $this->getFieldDefinition(),
        'view_mode' => 'default',
        'prepare' => TRUE,
        'label' => $label,
        'settings' => $settings,
        'third_party_settings' => $third_party_settings,
    ]);
}