class Some
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/pager/Some.php \Drupal\views\Plugin\views\pager\Some
- 10 core/modules/views/src/Plugin/views/pager/Some.php \Drupal\views\Plugin\views\pager\Some
- 8.9.x core/modules/views/src/Plugin/views/pager/Some.php \Drupal\views\Plugin\views\pager\Some
Plugin for views without pagers.
Plugin annotation
@ViewsPager(
id = "some",
title = @Translation("Display a specified number of items"),
help = @Translation("Display a limited number items that this view might find."),
display_types = {"basic"}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \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 extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\pager\PagerPluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\pager\Some extends \Drupal\views\Plugin\views\pager\PagerPluginBase
- class \Drupal\views\Plugin\views\pager\PagerPluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Some
Related topics
59 string references to 'Some'
- CategorizingPluginManagerTraitTest::testProcessDefinitionCategory in core/
tests/ Drupal/ Tests/ Core/ Plugin/ CategorizingPluginManagerTraitTest.php - @covers ::processDefinitionCategory[[api-linebreak]]
- DisplayPageTest::testReadMore in core/
modules/ views/ tests/ src/ Kernel/ Plugin/ DisplayPageTest.php - Tests the readmore functionality.
- DisplayPluginBase::defineOptions in core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php - PagerTest::testStorePagerSettings in core/
modules/ views/ tests/ src/ Functional/ Plugin/ PagerTest.php - Pagers was sometimes not stored.
- PathParentCacheContextTest::providerTestGetContext in core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ PathParentCacheContextTest.php - Provides a list of paths and expected cache contexts.
File
-
core/
modules/ views/ src/ Plugin/ views/ pager/ Some.php, line 19
Namespace
Drupal\views\Plugin\views\pagerView source
class Some extends PagerPluginBase {
public function summaryTitle() {
if (!empty($this->options['offset'])) {
return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', [
'@count' => $this->options['items_per_page'],
'@skip' => $this->options['offset'],
]);
}
return $this->formatPlural($this->options['items_per_page'], '@count item', '@count items', [
'@count' => $this->options['items_per_page'],
]);
}
protected function defineOptions() {
$options = parent::defineOptions();
$options['items_per_page'] = [
'default' => 10,
];
$options['offset'] = [
'default' => 0,
];
return $options;
}
/**
* Provide the default form for setting options.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$pager_text = $this->displayHandler
->getPagerText();
$form['items_per_page'] = [
'#title' => $pager_text['items per page title'],
'#type' => 'number',
'#min' => 0,
'#description' => $pager_text['items per page description'],
'#default_value' => $this->options['items_per_page'],
];
$form['offset'] = [
'#type' => 'number',
'#min' => 0,
'#title' => $this->t('Offset (number of items to skip)'),
'#description' => $this->t('For example, set this to 3 and the first 3 items will not be displayed.'),
'#default_value' => $this->options['offset'],
];
}
public function usePager() {
return FALSE;
}
public function useCountQuery() {
return FALSE;
}
public function query() {
$this->view->query
->setLimit($this->options['items_per_page']);
$this->view->query
->setOffset($this->options['offset']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.