public function RoleAccess::getPropertyDefinitions in Search API 8
Retrieves the properties this processor defines for the given datasource.
Property names have to start with a letter or an underscore, followed by any number of letters, numbers and underscores. To avoid collisions, it is also recommended to prefix the property name with the identifier of the module defining the processor.
Parameters
\Drupal\search_api\Datasource\DatasourceInterface|null $datasource: (optional) The datasource this set of properties belongs to. If NULL, the datasource-independent properties should be added (or modified).
Return value
\Drupal\search_api\Processor\ProcessorPropertyInterface[] An array of property definitions for that datasource, keyed by property names.
Overrides ProcessorPluginBase::getPropertyDefinitions
File
- src/
Plugin/ search_api/ processor/ RoleAccess.php, line 102
Class
- RoleAccess
- Adds access checks based on user roles.
Namespace
Drupal\search_api\Plugin\search_api\processorCode
public function getPropertyDefinitions(DatasourceInterface $datasource = NULL) {
$properties = [];
if (!$datasource) {
$definition = [
'label' => $this
->t('Role-based access information'),
'description' => $this
->t('Data needed to apply role-based item access'),
'type' => 'string',
'processor_id' => $this
->getPluginId(),
'hidden' => TRUE,
'is_list' => TRUE,
];
$properties[static::ROLE_ACCESS_FIELD] = new ProcessorProperty($definition);
}
return $properties;
}