class FormatterLegacyDiscoveryDecorator

Custom decorator to add legacy widgets.

Legacy formatters are discovered through the old hook_field_formatter_info() hook and handled by the Drupal\field\Plugin\field\formatter\LegacyFormatter class.

@todo Remove once all core formatters have been converted.

Hierarchy

Expanded class hierarchy of FormatterLegacyDiscoveryDecorator

1 file declares its use of FormatterLegacyDiscoveryDecorator
FormatterPluginManager.php in drupal/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
Definition of Drupal\field\Plugin\Type\Formatter\FormatterPluginManager..

File

drupal/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterLegacyDiscoveryDecorator.php, line 21
Definition of Drupal\field\Plugin\Type\Formatter\FormatterLegacyDiscoveryDecorator.

Namespace

Drupal\field\Plugin\Type\Formatter
View source
class FormatterLegacyDiscoveryDecorator extends LegacyDiscoveryDecorator {

  /**
   * Overrides Drupal\field\Plugin\Type\LegacyDiscoveryDecorator::$hook.
   */
  protected $hook = 'field_formatter_info';

  /**
   * Overrides Drupal\field\Plugin\Type\LegacyDiscoveryDecorator::processDefinition().
   */
  public function processDefinition(array &$definition) {
    $definition['class'] = '\\Drupal\\field\\Plugin\\field\\formatter\\LegacyFormatter';

    // Transform properties for which the format has changed.
    if (isset($definition['field types'])) {
      $definition['field_types'] = $definition['field types'];
      unset($definition['field types']);
    }
  }

}

Members