function gathercontent_entity_base_field_info in GatherContent 8.4
Same name and namespace in other branches
- 8.5 gathercontent.module \gathercontent_entity_base_field_info()
- 8.3 gathercontent.module \gathercontent_entity_base_field_info()
Implements hook_entity_base_field_info().
Add a 'GC mapping ID' and 'GC ID fields' base field to all node types.
File
- ./
gathercontent.module, line 23 - Main module file for GatherContent module.
Code
function gathercontent_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
if ($entity_type
->id() === 'node') {
$fields['gc_mapping_id'] = $storage_definition = BaseFieldDefinition::create('integer')
->setLabel(t('GC mapping ID'))
->setDescription(t('The ID of GatherContent mapping.'))
->setReadOnly(TRUE);
$fields['gc_id'] = $storage_definition = BaseFieldDefinition::create('integer')
->setLabel(t('GC ID'))
->setDescription(t('The ID of GatherContent content.'))
->setReadOnly(TRUE);
}
if ($entity_type
->id() === 'file') {
$fields['gc_id'] = $storage_definition = BaseFieldDefinition::create('integer')
->setLabel(t('GC ID'))
->setDescription(t('The ID of GatherContent content.'))
->setReadOnly(TRUE);
}
return $fields;
}