function apachesolr_paragraphs_indexing_callback in Apachesolr Paragraphs 7
Same name and namespace in other branches
- 8 apachesolr_paragraphs.module \apachesolr_paragraphs_indexing_callback()
Indexing callback for paragraph fields.
1 string reference to 'apachesolr_paragraphs_indexing_callback'
File
- ./
apachesolr_paragraphs.module, line 29 - Functionality for including paragraphs field contents in Apache Solr index.
Code
function apachesolr_paragraphs_indexing_callback($entity, $field_name, $index_key, $field_info) {
// Load each paragraphs item and add its fields to the index.
$fields = array();
if (!empty($entity->{$field_name})) {
module_load_include('module', 'paragraphs');
foreach ($entity->{$field_name} as $paragraphs) {
foreach ($paragraphs as $delta => $item) {
// Attempt to get paragraph entity.
if ($paragraph_entity = paragraphs_field_get_entity($item)) {
// Send paragraph entity to callback for adding fields.
apachesolr_paragraphs_add_paragraph_fields($fields, $paragraph_entity);
}
}
}
}
return $fields;
}