You are here

field_count_formatter.module in Field Count Formatter 8

Same filename and directory in other branches
  1. 7 field_count_formatter.module
  2. 2.x field_count_formatter.module

Adds all fields to the field types (the plugin definition does not allow this).

File

field_count_formatter.module
View source
<?php

/**
 * @file
 * Adds all fields to the field types (the plugin definition does not
 * allow this).
 */

/**
 * Implements hook_field_formatter_info_alter().
 */
function field_count_formatter_field_formatter_info_alter(array &$info) {
  if (isset($info['count'])) {
    $field_types = Drupal::service('plugin.manager.field.field_type')
      ->getDefinitions();
    $info['count']['field_types'] = array_keys($field_types);
  }
}