public function LegacyFormatter::settingsForm

Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().

Overrides FormatterBase::settingsForm

File

drupal/core/modules/field/lib/Drupal/field/Plugin/field/formatter/LegacyFormatter.php, line 30
Definition of Drupal\field\Plugin\field\formatter\LegacyFormatter.

Class

LegacyFormatter
Plugin implementation for legacy formatters.

Namespace

Drupal\field\Plugin\field\formatter

Code

public function settingsForm(array $form, array &$form_state) {
  $definition = $this
    ->getDefinition();
  $function = $definition['module'] . '_field_formatter_settings_form';

  // hook_field_formatter_settings_form() implementations read display
  // properties directly from $instance. Put the actual properties we use
  // here.
  $instance = clone $this->instance;
  $instance['display'][$this->viewMode] = array(
    'type' => $this
      ->getPluginId(),
    'settings' => $this
      ->getSettings(),
    'weight' => $this->weight,
    'label' => $this->label,
  );
  if (function_exists($function)) {
    return $function($this->field, $instance, $this->viewMode, $form, $form_state);
  }
  return array();
}