public static function GDPRFieldData::createFromWrapper in General Data Protection Regulation 7
Create the field data from a property wrapper.
Parameters
EntityMetadataWrapper $wrapper: The property wrapper to build field data from.
Return value
static New field data object.
1 call to GDPRFieldData::createFromWrapper()
- gdpr_fields_collect_gdpr_entities in modules/
gdpr_fields/ gdpr_fields.module - Collect entities that are connected to a GDPR task.
File
- modules/
gdpr_fields/ src/ Plugins/ GDPRFieldData.php, line 142 - Contains the GDPRFieldData class.
Class
- GDPRFieldData
- Class for storing GDPR metadata for fields.
Code
public static function createFromWrapper(EntityMetadataWrapper $wrapper) {
$entity_type = $bundle = $property_name = FALSE;
while (!$entity_type) {
$info = $wrapper
->info();
if (empty($info['parent'])) {
return NULL;
}
$wrapper = $info['parent'];
if ($wrapper instanceof EntityDrupalWrapper) {
$entity_type = $wrapper
->type();
$bundle = $wrapper
->getBundle();
$property_name = $info['name'];
break;
}
}
// @todo improve performance by loading specific plugin and not all.
$plugins = ctools_export_load_object('gdpr_fields_field_data');
$name = implode('|', array(
$entity_type,
$bundle,
$property_name,
));
if (isset($plugins[$name])) {
return $plugins[$name];
}
return static::createFromProperty($entity_type, $bundle, $property_name);
}