function gdpr_fields_gdpr_entity_property_get_children in General Data Protection Regulation 7
Gets all plugin children for a plugin type.
Parameters
array $plugin: The plugin to get children for.
string $parent: The parent plugin id.
Return value
array An array of child plugin definitions.
1 call to gdpr_fields_gdpr_entity_property_get_children()
- gdpr_fields_gdpr_entity_property_get_child in modules/
gdpr_fields/ plugins/ gdpr_data/ gdpr_entity_property.inc - Gets a specific child for a plugin type.
1 string reference to 'gdpr_fields_gdpr_entity_property_get_children'
- gdpr_entity_property.inc in modules/
gdpr_fields/ plugins/ gdpr_data/ gdpr_entity_property.inc
File
- modules/
gdpr_fields/ plugins/ gdpr_data/ gdpr_entity_property.inc, line 47
Code
function gdpr_fields_gdpr_entity_property_get_children(array $plugin, $parent) {
$plugins = array();
foreach (entity_get_property_info() as $entity_type => $property_info) {
// Get a list of bundles.
if (isset($property_info['bundles'])) {
$bundles = array_keys($property_info['bundles']);
}
else {
$bundles = array(
$entity_type,
);
}
// Get the plugins for each bundle.
foreach ($bundles as $bundle) {
$properties = array();
// Default properties.
foreach ($property_info['properties'] as $property_name => $property) {
$name = "{$entity_type}|{$bundle}|{$property_name}";
$properties[$name] = $property;
}
// Bundle properties.
if (isset($property_info['bundles'][$bundle])) {
foreach ($property_info['bundles'][$bundle]['properties'] as $property_name => $property) {
$name = "{$entity_type}|{$bundle}|{$property_name}";
$properties[$name] = $property;
}
}
// Add plugins for properties.
foreach ($properties as $name => $property) {
$child_plugin = $plugin;
$child_plugin['name'] = $name;
$child_plugin['label'] = $property['label'];
$child_plugin['description'] = isset($property['description']) ? $property['description'] : '';
// @todo Should computed properties be removed instead or disabled?
if (!empty($property['computed'])) {
$child_plugin['computed'] = TRUE;
}
$plugins[$name] = $child_plugin;
}
}
}
return $plugins;
}