public function AddURL::addFieldValues in Search API 8
Adds the values of properties defined by this processor to the item.
Parameters
\Drupal\search_api\Item\ItemInterface $item: The item whose field values should be added.
Overrides ProcessorPluginBase::addFieldValues
File
- src/
Plugin/ search_api/ processor/ AddURL.php, line 48
Class
- AddURL
- Adds the item's URL to the indexed data.
Namespace
Drupal\search_api\Plugin\search_api\processorCode
public function addFieldValues(ItemInterface $item) {
$url = $item
->getDatasource()
->getItemUrl($item
->getOriginalObject());
if ($url) {
$fields = $item
->getFields(FALSE);
$fields = $this
->getFieldsHelper()
->filterForPropertyPath($fields, NULL, 'search_api_url');
foreach ($fields as $field) {
$config = $field
->getConfiguration();
$url
->setAbsolute(!empty($config['absolute']));
$field
->addValue($url
->toString());
}
}
}