protected function ExtractedText::extractFileContents in Search API attachments 9.0.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/ExtractedText.php \Drupal\search_api_attachments\Plugin\Field\FieldFormatter\ExtractedText::extractFileContents()
Extracts content of given file.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the file is attached to.
\Drupal\file\Entity\File $file: A file object.
Return value
string|null Content of the file or NULL if type of file is not supported.
1 call to ExtractedText::extractFileContents()
- ExtractedText::viewElements in src/
Plugin/ Field/ FieldFormatter/ ExtractedText.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ ExtractedText.php, line 186
Class
- ExtractedText
- File formatter displaying text extracted form attachment document.
Namespace
Drupal\search_api_attachments\Plugin\Field\FieldFormatterCode
protected function extractFileContents(EntityInterface $entity, File $file) {
if ($this
->isFileIndexable($file)) {
return $this->extractor
->extractOrGetFromCache($entity, $file, $this->extractionMethod);
}
return NULL;
}