You are here

public function Drupal8::fieldInfoFields in Realistic Dummy Content 8.2

Same name and namespace in other branches
  1. 7.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::fieldInfoFields()
  2. 3.x api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::fieldInfoFields()
1 call to Drupal8::fieldInfoFields()
Drupal8::fieldInfoField in api/src/Framework/Drupal8.php

File

api/src/Framework/Drupal8.php, line 151

Class

Drupal8
Drupal 8-specific code.

Namespace

Drupal\realistic_dummy_content_api\Framework

Code

public function fieldInfoFields() {
  $return = array();
  $field_map = \Drupal::entityManager()
    ->getFieldMap();

  // Field map returns:
  // entitytype/name(type, bundles(article => article))
  // we must change that into:
  // name(entity_types=>(node), type=>type, bundles=>node(page, article))
  foreach ($field_map as $entity_type => $fields) {
    foreach ($fields as $field => $field_info) {
      $return[$field]['entity_types'][$entity_type] = $entity_type;
      $return[$field]['field_name'] = $field;
      $return[$field]['type'] = $field_info['type'];
      $return[$field]['bundles'][$entity_type] = $field_info['bundles'];
      $this
        ->addFieldSettings($return, $field, $field_info);
    }
  }
  return $return;
}