You are here

public function ExtractedText::__construct in Search API attachments 8

Same name and namespace in other branches
  1. 9.0.x src/Plugin/Field/FieldFormatter/ExtractedText.php \Drupal\search_api_attachments\Plugin\Field\FieldFormatter\ExtractedText::__construct()

ExtractedText constructor.

Parameters

string $pluginId: The plugin id.

mixed $pluginDefinition: The plugin definition.

\Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition: The field definitions.

array $settings: The settings.

string $label: The label.

string $viewMode: The view mode.

array $thirdPartySettings: The third party settings.

\Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler: The module handler.

\Drupal\search_api\Processor\ProcessorPluginManager $processorPluginManager: The processor plugin manager.

\Drupal\search_api_attachments\TextExtractorPluginManager $textExtractorPluginManager: The text extractor plugin manager.

\Drupal\Core\Config\Config $config: The configuration.

\Drupal\search_api_attachments\ExtractFileValidator $extractFileValidator: The extract file validator.

Overrides FormatterBase::__construct

File

src/Plugin/Field/FieldFormatter/ExtractedText.php, line 110

Class

ExtractedText
File formatter displaying text extracted form attachment document.

Namespace

Drupal\search_api_attachments\Plugin\Field\FieldFormatter

Code

public function __construct($pluginId, $pluginDefinition, FieldDefinitionInterface $fieldDefinition, array $settings, $label, $viewMode, array $thirdPartySettings, ModuleHandlerInterface $moduleHandler, ProcessorPluginManager $processorPluginManager, TextExtractorPluginManager $textExtractorPluginManager, Config $config, ExtractFileValidator $extractFileValidator) {
  parent::__construct($pluginId, $pluginDefinition, $fieldDefinition, $settings, $label, $viewMode, $thirdPartySettings);
  $this->moduleHandler = $moduleHandler;
  $this->processorPluginManager = $processorPluginManager;
  $this->textExtractorPluginManager = $textExtractorPluginManager;
  $this->config = $config;
  $this->extractFileValidator = $extractFileValidator;
  $extractorPluginId = $this->config
    ->get('extraction_method');
  $configuration = $this->config
    ->get($extractorPluginId . '_configuration');
  $this->extractionMethod = $this->textExtractorPluginManager
    ->createInstance($extractorPluginId, $configuration);
  $this->extractor = $this->processorPluginManager
    ->createInstance('file_attachments');
}