You are here

public function FilesExtractor::getPropertyDefinitions in Search API attachments 9.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/search_api/processor/FilesExtractor.php \Drupal\search_api_attachments\Plugin\search_api\processor\FilesExtractor::getPropertyDefinitions()

File

src/Plugin/search_api/processor/FilesExtractor.php, line 160

Class

FilesExtractor
Provides file fields processor.

Namespace

Drupal\search_api_attachments\Plugin\search_api\processor

Code

public function getPropertyDefinitions(DatasourceInterface $datasource = NULL) {
  $properties = [];
  if (!$datasource) {

    // Add properties for all index available file fields and for file entity.
    foreach ($this
      ->getFileFieldsAndFileEntityItems() as $field_name => $label) {
      $definition = [
        'label' => $this
          ->t('Search api attachments: @label', [
          '@label' => $label,
        ]),
        'description' => $this
          ->t('Search api attachments: @label', [
          '@label' => $label,
        ]),
        'type' => 'string',
        'processor_id' => $this
          ->getPluginId(),
      ];
      $properties[static::SAA_PREFIX . $field_name] = new ProcessorProperty($definition);
    }
  }
  return $properties;
}