public function FieldResultFunction::getDerivativeDefinitions in Votingapi Widgets 8
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ Derivative/ FieldResultFunction.php, line 44
Class
- FieldResultFunction
- Deriver base class for field vote calculations.
Namespace
Drupal\votingapi_widgets\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$instances = $this->entityFieldManager
->getFieldMapByFieldType('voting_api_field');
$this->derivatives = [];
foreach ($instances as $entity_type => $fields) {
foreach (array_keys($fields) as $field_name) {
$plugin_id = $entity_type . '.' . $field_name;
$this->derivatives[$plugin_id] = $base_plugin_definition;
}
}
return $this->derivatives;
}