Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Toolbar Class Reference

Public Member Functions

 __construct (\Magento\Framework\App\Request\Http $request)
 
 getOrder ()
 
 getDirection ()
 
 getMode ()
 
 getLimit ()
 
 getCurrentPage ()
 

Data Fields

const PAGE_PARM_NAME = 'p'
 
const ORDER_PARAM_NAME = 'product_list_order'
 
const DIRECTION_PARAM_NAME = 'product_list_dir'
 
const MODE_PARAM_NAME = 'product_list_mode'
 
const LIMIT_PARAM_NAME = 'product_list_limit'
 

Protected Attributes

 $request
 

Detailed Description

Class Toolbar

@api

Since
100.0.2

Definition at line 14 of file Toolbar.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\Request\Http  $request)
Parameters
\Magento\Framework\App\Request\Http$request

Definition at line 51 of file Toolbar.php.

53  {
54  $this->request = $request;
55  }

Member Function Documentation

◆ getCurrentPage()

getCurrentPage ( )

Return current page from request

Returns
int

Definition at line 102 of file Toolbar.php.

103  {
104  $page = (int) $this->request->getParam(self::PAGE_PARM_NAME);
105  return $page ?: 1;
106  }
$page
Definition: pages.php:8

◆ getDirection()

getDirection ( )

Get sort direction

Returns
string|bool

Definition at line 72 of file Toolbar.php.

73  {
74  return $this->request->getParam(self::DIRECTION_PARAM_NAME);
75  }

◆ getLimit()

getLimit ( )

Get products per page limit

Returns
string|bool

Definition at line 92 of file Toolbar.php.

93  {
94  return $this->request->getParam(self::LIMIT_PARAM_NAME);
95  }

◆ getMode()

getMode ( )

Get sort mode

Returns
string|bool

Definition at line 82 of file Toolbar.php.

83  {
84  return $this->request->getParam(self::MODE_PARAM_NAME);
85  }

◆ getOrder()

getOrder ( )

Get sort order

Returns
string|bool

Definition at line 62 of file Toolbar.php.

63  {
64  return $this->request->getParam(self::ORDER_PARAM_NAME);
65  }

Field Documentation

◆ $request

$request
protected

Definition at line 46 of file Toolbar.php.

◆ DIRECTION_PARAM_NAME

const DIRECTION_PARAM_NAME = 'product_list_dir'

Sort direction cookie name

Definition at line 29 of file Toolbar.php.

◆ LIMIT_PARAM_NAME

const LIMIT_PARAM_NAME = 'product_list_limit'

Products per page limit order cookie name

Definition at line 39 of file Toolbar.php.

◆ MODE_PARAM_NAME

const MODE_PARAM_NAME = 'product_list_mode'

Sort mode cookie name

Definition at line 34 of file Toolbar.php.

◆ ORDER_PARAM_NAME

const ORDER_PARAM_NAME = 'product_list_order'

Sort order cookie name

Definition at line 24 of file Toolbar.php.

◆ PAGE_PARM_NAME

const PAGE_PARM_NAME = 'p'

GET parameter page variable name

Definition at line 19 of file Toolbar.php.


The documentation for this class was generated from the following file: