You are here

function conditional_fields_conditional_fields in Conditional Fields 8

Same name and namespace in other branches
  1. 4.x conditional_fields.module \conditional_fields_conditional_fields()

Implements hook_conditional_fields().

We implement this on behalf of the core Field module.

File

./conditional_fields.module, line 82
Contains conditional_fields.module.

Code

function conditional_fields_conditional_fields($entity_type, $bundle_name) {
  $fields = [];
  $instances = \Drupal::getContainer()
    ->get("entity_field.manager")
    ->getFieldDefinitions($entity_type, $bundle_name);
  foreach ($instances as $field) {
    $fields[$field
      ->getName()] = $field
      ->getLabel();
  }
  return $fields;
}