You are here

function hook_conditional_fields_children in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 conditional_fields.api.php \hook_conditional_fields_children()

Return a list of fields contained within a given field.

Various modules provide fields that themselves contain other fields (e.g., Field Group, Paragraphs, etc.) This hook allows those modules to provide the logic necessary to determine which fields are contained within such a field.

Parameters

string $entity_type: Name of the entity type being configured.

string $bundle_name: Name of the entity bundle being configured.

Return value

array Keys are parent fields, values are lists of children.

See also

DependencyHelper::getInheritingFieldNames()

hook_conditional_fields_children_alter()

field_group_conditional_fields_children()

File

./conditional_fields.api.php, line 80
Hooks for the conditional_fields module.

Code

function hook_conditional_fields_children($entity_type, $bundle_name) {
  $groups = [];
  $group_info = field_group_info_groups($entity_type, $bundle_name, 'form', 'default');
  foreach ($group_info as $name => $info) {
    $groups[$name] = $info->children;
  }
  return $groups;
}