| @@ 24-45 (lines=22) @@ | ||
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function getFieldFormatter() { |
|
| 25 | if (!isset($this->fieldFormatter)) { |
|
| 26 | $display = [ |
|
| 27 | 'type' => $this->getFieldFormatterId(), |
|
| 28 | 'settings' => [ |
|
| 29 | 'view_mode' => $this->getPluginDefinition()['view_mode'], |
|
| 30 | ], |
|
| 31 | 'label' => 'hidden', |
|
| 32 | ]; |
|
| 33 | ||
| 34 | // Create the formatter plugin. Will use the default formatter for that |
|
| 35 | // field type if none is passed. |
|
| 36 | $this->fieldFormatter = $this->formatterPluginManager->getInstance( |
|
| 37 | [ |
|
| 38 | 'field_definition' => $this->getFieldDefinition(), |
|
| 39 | 'view_mode' => '_entity_embed', |
|
| 40 | 'configuration' => $display, |
|
| 41 | ] |
|
| 42 | ); |
|
| 43 | } |
|
| 44 | return $this->fieldFormatter; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * {@inheritdoc} |
|
| @@ 193-213 (lines=21) @@ | ||
| 190 | * @return \Drupal\Core\Field\FormatterInterface |
|
| 191 | * The formatter object. |
|
| 192 | */ |
|
| 193 | public function getFieldFormatter() { |
|
| 194 | if (!isset($this->fieldFormatter)) { |
|
| 195 | $display = array( |
|
| 196 | 'type' => $this->getFieldFormatterId(), |
|
| 197 | 'settings' => $this->getConfiguration(), |
|
| 198 | 'label' => 'hidden', |
|
| 199 | ); |
|
| 200 | ||
| 201 | // Create the formatter plugin. Will use the default formatter for that |
|
| 202 | // field type if none is passed. |
|
| 203 | $this->fieldFormatter = $this->formatterPluginManager->getInstance( |
|
| 204 | array( |
|
| 205 | 'field_definition' => $this->getFieldDefinition(), |
|
| 206 | 'view_mode' => '_entity_embed', |
|
| 207 | 'configuration' => $display, |
|
| 208 | ) |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | ||
| 212 | return $this->fieldFormatter; |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * Creates a new faux-field definition. |
|