class Random
Same name in this branch
- 9 core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/sort/Random.php \Drupal\views\Plugin\views\sort\Random
- 11.x core/tests/Drupal/TestTools/Random.php \Drupal\TestTools\Random
- 11.x core/lib/Drupal/Component/Utility/Random.php \Drupal\Component\Utility\Random
Handle a random sort.
Plugin annotation
@ViewsSort("random");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\sort\SortPluginBase extends \Drupal\Core\Cache\CacheableDependencyInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\sort\Random extends \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Cache\UncacheableDependencyTrait implements \Drupal\views\Plugin\views\sort\SortPluginBase
- class \Drupal\views\Plugin\views\sort\SortPluginBase extends \Drupal\Core\Cache\CacheableDependencyInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Random
6 string references to 'Random'
- RotateImageEffect::submitConfigurationForm in core/
modules/ image/ src/ Plugin/ ImageEffect/ RotateImageEffect.php - SortRandomTest::getBasicRandomView in core/
modules/ views/ tests/ src/ Kernel/ Handler/ SortRandomTest.php - Return a basic view with random ordering.
- TaxonomyViewsFieldAccessTest::testTermFields in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyViewsFieldAccessTest.php - Check access for taxonomy fields.
- 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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.