public static function GDPRFieldData::createFromPlugin in General Data Protection Regulation 7
Create field data from plugin definition.
Parameters
array $plugin: An array of duplicates. Each item should be an array with 2 party id.
Return value
static New field data object.
2 calls to GDPRFieldData::createFromPlugin()
- GDPRFieldData::createFromProperty in modules/
gdpr_fields/ src/ Plugins/ GDPRFieldData.php - Create field data from property name, entity type and bundle.
- gdpr_fields_gdpr_fields_default_field_data in modules/
gdpr_fields/ gdpr_fields.module - Implements hook_gdpr_fields_default_field_data().
File
- modules/
gdpr_fields/ src/ Plugins/ GDPRFieldData.php, line 78 - Contains the GDPRFieldData class.
Class
- GDPRFieldData
- Class for storing GDPR metadata for fields.
Code
public static function createFromPlugin(array $plugin) {
$field = new static();
list($entity_type, $entity_bundle, $property_name) = explode('|', $plugin['name']);
$field->entity_type = $entity_type;
$field->entity_bundle = $entity_bundle;
$field->property_name = $property_name;
$field->name = $plugin['name'];
// @todo Should computed properties be removed instead or disabled?
if (!empty($plugin['computed'])) {
$field->computed = TRUE;
$field->disabled = TRUE;
}
if (isset($plugin['label'])) {
$field->label = $plugin['label'];
$field
->setSetting('label', $plugin['label']);
}
if (isset($plugin['description'])) {
$field->description = $plugin['label'];
$field
->setSetting('description', $plugin['description']);
}
return $field;
}