You are here

protected function AggregatedFieldProperty::getDatasourceLabelPrefixes in Search API 8

Retrieves label prefixes for an index's datasources.

Parameters

\Drupal\search_api\IndexInterface $index: The search index.

Return value

string[] An associative array mapping datasource IDs (and an empty string for datasource-independent properties) to their label prefixes.

2 calls to AggregatedFieldProperty::getDatasourceLabelPrefixes()
AggregatedFieldProperty::buildConfigurationForm in src/Plugin/search_api/processor/Property/AggregatedFieldProperty.php
Constructs a configuration form for a field based on this property.
AggregatedFieldProperty::getFieldDescription in src/Plugin/search_api/processor/Property/AggregatedFieldProperty.php
Retrieves the description for a field based on this property.

File

src/Plugin/search_api/processor/Property/AggregatedFieldProperty.php, line 200

Class

AggregatedFieldProperty
Defines an "aggregated field" property.

Namespace

Drupal\search_api\Plugin\search_api\processor\Property

Code

protected function getDatasourceLabelPrefixes(IndexInterface $index) {
  $prefixes = [
    NULL => $this
      ->t('General') . ' » ',
  ];
  foreach ($index
    ->getDatasources() as $datasource_id => $datasource) {
    $prefixes[$datasource_id] = $datasource
      ->label() . ' » ';
  }
  return $prefixes;
}