class Random in Drupal 10
Same name in this branch
- 10 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random
- 10 core/modules/views/src/Plugin/views/sort/Random.php \Drupal\views\Plugin\views\sort\Random
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/sort/Random.php \Drupal\views\Plugin\views\sort\Random
- 9 core/modules/views/src/Plugin/views/sort/Random.php \Drupal\views\Plugin\views\sort\Random
Handle a random sort.
Plugin annotation
@ViewsSort("random");
Hierarchy
- class \Drupal\views\Plugin\views\sort\SortPluginBase extends \Drupal\views\Plugin\views\HandlerBase implements CacheableDependencyInterface
- class \Drupal\views\Plugin\views\sort\Random implements CacheableDependencyInterface uses UncacheableDependencyTrait
Expanded class hierarchy of Random
2 string references to 'Random'
- views.sort.schema.yml in core/
modules/ views/ config/ schema/ views.sort.schema.yml - core/modules/views/config/schema/views.sort.schema.yml
- views_views_data in core/
modules/ views/ views.views.inc - Implements hook_views_data().
File
- core/
modules/ views/ src/ Plugin/ views/ sort/ Random.php, line 14
Namespace
Drupal\views\Plugin\views\sortView source
class Random extends SortPluginBase implements CacheableDependencyInterface {
use UncacheableDependencyTrait;
/**
* {@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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Random:: |
public | function |
Basic options for all sort criteria. Overrides SortPluginBase:: |
|
Random:: |
public | function |
Called to add the sort to a query. Overrides SortPluginBase:: |
|
Random:: |
public | function | ||
SortPluginBase:: |
public | function | Display whether or not the sort order is ascending or descending. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
public | function | Determine if a sort can be exposed. | |
SortPluginBase:: |
public | function | Provide default options for exposed sorts. | |
SortPluginBase:: |
protected | function | 1 | |
SortPluginBase:: |
public | function | Shortcut to display the expose/hide button. | |
SortPluginBase:: |
protected | function | Shortcut to display the value form. | |
SortPluginBase:: |
protected | function | Provide a list of options for the default sort form. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
protected | function | ||
SortPluginBase:: |
public | function | Simple submit handler. | |
SortPluginBase:: |
public static | function | ||
SortPluginBase:: |
public | function | Validate the options form. | |
SortPluginBase:: |
public | function | Simple validate handler. | |
UncacheableDependencyTrait:: |
public | function | ||
UncacheableDependencyTrait:: |
public | function | ||
UncacheableDependencyTrait:: |
public | function |