class EntityPagerFactory in Entity Pager 8
Same name and namespace in other branches
- 2.0.x src/EntityPagerFactory.php \Drupal\entity_pager\EntityPagerFactory
Factory for entity pager objects.
Hierarchy
- class \Drupal\entity_pager\EntityPagerFactory
Expanded class hierarchy of EntityPagerFactory
1 string reference to 'EntityPagerFactory'
1 service uses EntityPagerFactory
File
- src/
EntityPagerFactory.php, line 11
Namespace
Drupal\entity_pagerView source
class EntityPagerFactory {
/**
* The token service.
*
* @var \Drupal\Core\Utility\Token
*/
protected $token;
/**
* Default options.
*
* @var array
*/
// phpcs:ignore -- Cannot change member name as this would be an API change.
protected $default_options = [
'link_next' => 'next >',
'link_prev' => '< prev',
'link_all_url' => '<front>',
'link_all_text' => 'Home',
'display_all' => TRUE,
'display_count' => TRUE,
'show_disabled_links' => TRUE,
'circular_paging' => FALSE,
'log_performance' => TRUE,
];
/**
* EntityPagerFactory constructor.
*
* @param \Drupal\Core\Utility\Token $token
* The token service.
*/
public function __construct(Token $token) {
$this->token = $token;
}
/**
* Returns a newly constructed entity pager.
*
* @param \Drupal\views\ViewExecutable $view
* The executable to construct an entity pager for.
* @param array $options
* (optional) Options for the entity pager.
*
* @return \Drupal\entity_pager\EntityPagerInterface
* The entity pager object.
*/
public function get(ViewExecutable $view, array $options = []) {
$options = empty($options) ? $this->default_options : array_merge($this->default_options, $options);
return new EntityPager($view, $options, $this->token);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityPagerFactory:: |
protected | property | ||
EntityPagerFactory:: |
protected | property | The token service. | |
EntityPagerFactory:: |
public | function | Returns a newly constructed entity pager. | |
EntityPagerFactory:: |
public | function | EntityPagerFactory constructor. |