class DummyFields in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/search_api/processor/DummyFields.php \Drupal\search_api_solr\Plugin\search_api\processor\DummyFields
- 8.2 src/Plugin/search_api/processor/DummyFields.php \Drupal\search_api_solr\Plugin\search_api\processor\DummyFields
Adds dummy fields to the indexed data.
Plugin annotation
@SearchApiProcessor(
id = "solr_dummy_fields",
label = @Translation("Solr dummy fields"),
description = @Translation("Adds dummy fields to all datasources to register a pseudo field names that get their values via API, for example hook_search_api_solr_documents_alter()."),
stages = {
"add_properties" = 0,
},
locked = false,
hidden = false,
)
Hierarchy
- class \Drupal\search_api_solr\Plugin\search_api\processor\DummyFields extends \Drupal\search_api\Processor\ProcessorPluginBase
Expanded class hierarchy of DummyFields
File
- src/
Plugin/ search_api/ processor/ DummyFields.php, line 24
Namespace
Drupal\search_api_solr\Plugin\search_api\processorView source
class DummyFields extends ProcessorPluginBase {
/**
* {@inheritdoc}
*/
public function getPropertyDefinitions(DatasourceInterface $datasource = NULL) {
$properties = [];
if ($datasource) {
$definition = [
'label' => $this
->t('Dummy field'),
'description' => $this
->t('Adds dummy field that gets its values via API, for example hook_search_api_solr_documents_alter().'),
'type' => 'string',
'processor_id' => $this
->getPluginId(),
'is_list' => TRUE,
];
$properties['dummy_field'] = new DummyFieldProperty($definition);
}
return $properties;
}
/**
* {@inheritdoc}
*/
public function addFieldValues(ItemInterface $item) {
$fields = $this
->getFieldsHelper()
->filterForPropertyPath($item
->getFields(), $item
->getDatasourceId(), 'dummy_field');
foreach ($fields as $field) {
$configuration = $field
->getConfiguration();
$field
->addValue($configuration['dummy_value']);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DummyFields:: |
public | function | ||
DummyFields:: |
public | function |