Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / src / Plugin / views / sort / Random.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\sort;
4
5 use Drupal\Core\Cache\CacheableDependencyInterface;
6 use Drupal\Core\Cache\UncacheableDependencyTrait;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * Handle a random sort.
11  *
12  * @ViewsSort("random")
13  */
14 class Random extends SortPluginBase implements CacheableDependencyInterface {
15
16   use UncacheableDependencyTrait;
17
18   /**
19    * {@inheritdoc}
20    */
21   public function usesGroupBy() {
22     return FALSE;
23   }
24
25   public function query() {
26     $this->query->addOrderBy('rand');
27   }
28
29   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
30     parent::buildOptionsForm($form, $form_state);
31     $form['order']['#access'] = FALSE;
32   }
33
34 }