Random.php in Zircon Profile 8.0
Same filename in this branch
Same filename and directory in other branches
Contains \Drupal\views\Plugin\views\sort\Random.
Namespace
Drupal\views\Plugin\views\sortFile
core/modules/views/src/Plugin/views/sort/Random.phpView source
<?php
/**
* @file
* Contains \Drupal\views\Plugin\views\sort\Random.
*/
namespace Drupal\views\Plugin\views\sort;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Handle a random sort.
*
* @ViewsSort("random")
*/
class Random extends SortPluginBase implements CacheableDependencyInterface {
/**
* {@inheritdoc}
*/
public function usesGroupBy() {
return FALSE;
}
public function query() {
$this->query
->addOrderBy('rand');
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['order']['#access'] = FALSE;
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return 0;
}
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
return [];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
}