Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
26
vendor/chi-teck/drupal-code-generator/templates/d8/hook/ranking.twig
vendored
Normal file
26
vendor/chi-teck/drupal-code-generator/templates/d8/hook/ranking.twig
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Implements hook_ranking().
|
||||
*/
|
||||
function {{ machine_name }}_ranking() {
|
||||
// If voting is disabled, we can avoid returning the array, no hard feelings.
|
||||
if (\Drupal::config('vote.settings')->get('node_enabled')) {
|
||||
return [
|
||||
'vote_average' => [
|
||||
'title' => t('Average vote'),
|
||||
// Note that we use i.sid, the search index's search item id, rather than
|
||||
// n.nid.
|
||||
'join' => [
|
||||
'type' => 'LEFT',
|
||||
'table' => 'vote_node_data',
|
||||
'alias' => 'vote_node_data',
|
||||
'on' => 'vote_node_data.nid = i.sid',
|
||||
],
|
||||
// The highest possible score should be 1, and the lowest possible score,
|
||||
// always 0, should be 0.
|
||||
'score' => 'vote_node_data.average / CAST(%f AS DECIMAL)',
|
||||
// Pass in the highest possible voting score as a decimal argument.
|
||||
'arguments' => [\Drupal::config('vote.settings')->get('score_max')],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
Reference in a new issue