SilverStripe\TextExtraction\Extension\FileTextExtractable
Decorate File or a File derivative to enable text extraction from the file content. Uses a set of subclasses of FileTextExtractor to do the extraction based on the content type of the file.
Adds an additional property which is the cached contents, which is populated on demand.
- Author: mstephens
Synopsis
class FileTextExtractable
extends DataExtension
{
- // members
- private static array $db = ;
- private static array $casting = ;
- private static array $dependencies = ;
- protected FileTextCache $fileTextCache = NULL;
- // methods
- public $this setTextCache()
- public FileTextCache getTextCache()
- public string getFileContent()
- public string|null extractFileAsText()
- public void onBeforeWrite()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
- $casting — array
- $db — array
- $dependencies — array
protected
- $fileTextCache — SilverStripe\TextExtraction\Cache\FileTextCache
Methods
public
- extractFileAsText() — Tries to parse the file contents if a FileTextExtractor class exists to handle the file type, and returns the text. The value is also cached into the File record itself.
- getFileContent() — Helper function for template
- getTextCache()
- onBeforeWrite()
- setTextCache()