Task/Collect/FieldTypesCollector.php
public function collect($job_list) {
    $plugin_manager = \Drupal::service('plugin.manager.field.field_type');
    $plugin_definitions = $plugin_manager->getDefinitions();

    $field_types_data = [];

    foreach ($plugin_definitions as $plugin_id => $plugin_definition) {
      $field_types_data[$plugin_id] = [
        'type' => $plugin_id,
        // Labels and descriptions need to be stringified from
        // TranslatableMarkup.
        'label' => (string) $plugin_definition['label'],
        // Some field types brokenly don't define a description.
        'description' => (string) ( $plugin_definition['description'] ?? $plugin_definition['label'] ),
        // Some of the weirder plugins don't have these.
        'default_widget' => $plugin_definition['default_widget'] ?? '',
        'default_formatter' => $plugin_definition['default_formatter'] ?? '',
      ];
    }

    // Filter for testing sample data collection.
    if (!empty($this->environment->sample_data_write)) {
      $field_types_data = array_intersect_key($field_types_data, $this->testingFieldTypes);
    }

    uasort($field_types_data, function($a, $b) {
      return strcmp($a['label'], $b['label']);
    });

    return $field_types_data;
  }
public function collect($job_list) {
    $plugin_manager = \Drupal::service('plugin.manager.field.field_type');
    $plugin_definitions = $plugin_manager->getDefinitions();

    $field_types_data = [];

    foreach ($plugin_definitions as $plugin_id => $plugin_definition) {
      $field_types_data[$plugin_id] = [
        'type' => $plugin_id,
        // Labels and descriptions need to be stringified from
        // TranslatableMarkup.
        'label' => (string) $plugin_definition['label'],
        // Some field types brokenly don't define a description.
        'description' => (string) ( $plugin_definition['description'] ?? $plugin_definition['label'] ),
        // Some of the weirder plugins don't have these.
        'default_widget' => $plugin_definition['default_widget'] ?? '',
        'default_formatter' => $plugin_definition['default_formatter'] ?? '',
      ];
    }

    // Filter for testing sample data collection.
    if (!empty($this->environment->sample_data_write)) {
      $field_types_data = array_intersect_key($field_types_data, $this->testingFieldTypes);
    }

    uasort($field_types_data, function($a, $b) {
      return strcmp($a['label'], $b['label']);
    });

    return $field_types_data;
  }
public function collect ( $ job_list ) { $ plugin_manager = \ Drupal :: service ( 'plugin.manager.field.field_type' ) ; $ plugin_definitions = $ plugin_manager -> getDefinitions ( ) ; $ field_types_data = [ ] ; foreach ( $ plugin_definitions as $ plugin_id => $ plugin_definition ) { $ field_types_data [ $ plugin_id ] = [ 'type' => $ plugin_id , // Labels and descriptions need to be stringified from // TranslatableMarkup. 'label' => ( string ) $ plugin_definition [ 'label' ] , // Some field types brokenly don't define a description. 'description' => ( string ) ( $ plugin_definition [ 'description' ] ?? $ plugin_definition [ 'label' ] ) , // Some of the weirder plugins don't have these. 'default_widget' => $ plugin_definition [ 'default_widget' ] ?? '' , 'default_formatter' => $ plugin_definition [ 'default_formatter' ] ?? '' , ] ; } // Filter for testing sample data collection. if ( ! empty ( $ this -> environment -> sample_data_write ) ) { $ field_types_data = array_intersect_key ( $ field_types_data , $ this -> testingFieldTypes ) ; } uasort ( $ field_types_data , function ( $ a , $ b ) { return strcmp ( $ a [ 'label' ] , $ b [ 'label' ] ) ; } ) ; return $ field_types_data ; }
Gets definitions of field types.

@return array
An array whose keys are the field types, and whose values are arrays
containing:
- 'type': The field type, that is, the field type plugin ID.
- 'label': The field type label.
- 'description': The field type description.
- 'default_widget': The default widget plugin ID.
- 'default_formatter': The default formatter plugin ID.
Gets definitions of field types .