-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Proposal
The current entity reference label resolution in extractItemValue() only resolves the label for the referenced entity. For better AI/analysis output, consider enhancing the entity reference data structure.
Current Implementation
File: src/Service/ContentIntelCollector.php
Lines: 360-371
if (in_array($type, ['entity_reference', 'entity_reference_revisions'])) {
$entity = $item->entity;
if ($entity) {
return [
'target_id' => $item->target_id,
'target_type' => $entity->getEntityTypeId(),
'label' => $entity->label(),
];
}
return ['target_id' => $item->target_id];
}Proposed Enhancements
1. Add Bundle Information
For taxonomy terms, knowing the vocabulary is often more useful than just "taxonomy_term":
return [
'target_id' => $item->target_id,
'target_type' => $entity->getEntityTypeId(),
'target_bundle' => $entity->bundle(), // e.g., "tags", "categories"
'label' => $entity->label(),
];2. Add URL for Linkable Entities
if ($entity->hasLinkTemplate('canonical')) {
$data['url'] = $entity->toUrl('canonical')->setAbsolute()->toString();
}3. Handle Media Entities Specially
Media entities often benefit from including the source file URL:
if ($entity->getEntityTypeId() === 'media') {
$source = $entity->getSource();
$source_field = $source->getSourceFieldDefinition($entity->bundle);
// Extract thumbnail or source file URL
}Benefits
- Richer Data: More context about referenced entities
- AI-Friendly: Better understanding of relationships
- Reduced Lookups: Consumers don't need to make additional API calls
Involved Components
src/Service/ContentIntelCollector.php- EnhanceextractItemValue()method
Metadata
Metadata
Assignees
Labels
No labels