- Issue created by @jhedstrom
- 🇺🇸United States jhedstrom Portland, OR
I added some proof-of-concept code that works. Some refinement would be needed to get this fully working across all entity types, etc.
- First commit to issue fork.
The AI Content Suggestions module currently looks for text fields in the node form. There are instances where it would be valuable to extract text fields from referenced items in the form. For example, an associated Media item with an extracted text field of the uploaded document could be used to suggest content. Another example would be the description fields on referenced taxonomy terms.
There's already similar handling for Paragraph entities:
// If we already have a paragraph of the correct type, just
// reuse it.
$paragraph = ($paragraph && $paragraph->bundle() == $bundle) ? $paragraph : $this->entityTypeManager->getStorage('paragraph')
->create([
'type' => $bundle,
]);
foreach ($this->getAllTextFields($paragraph, $form[$name]['widget'][$key]['subform']) as $machine => $label) {
$identifier = implode(':', [$name, $key, 'subform', $machine]);
$options[$identifier] = $field->getLabel() . ' (' . $key . ') > ' . $label;
}
Attempt to load referenced entities and add any data from the fields on that entity that are text fields.
Active
1.1
Other Submodules
I added some proof-of-concept code that works. Some refinement would be needed to get this fully working across all entity types, etc.