PHP Class DiscussionsSortFilterModule, vanilla

Renders a sort/filter module on a discussions view based on the sorts and filters in the Discussion Model. If there are category-specific filters, the categoryID property must be set in order for it to render the filters for the category.
Inheritance: extends Gdn_Module
ファイルを表示 Open project: vanilla/vanilla

Protected Properties

Property Type Description
$categoryID The ID of the category we're in.
$dropdownView The view of the dropdown module to render.
$filters The filters to render.
$selectedFilters The selected filters.
$selectedSort The selected sort.
$showFilters Whether to show the filter options in the view.
$showSorts Whether to show the sorting options in the view.
$sorts The sorts to render.

Public Methods

Method Description
__construct ( integer $categoryID, string $selectedSort = '', array $selectedFilters = [] )
prepare ( ) : boolean Checks whether we should even render this whole thing.
setDropdownView ( string $dropdownView ) : DiscussionsSortFilterModule
setShowFilters ( $showFilters ) : DiscussionsSortFilterModule
setShowSorts ( $showSorts ) : DiscussionsSortFilterModule
showFilters ( ) : boolean
showSorts ( ) : boolean

Protected Methods

Method Description
getFilterDropdowns ( ) : array Returns an array of dropdown menus with the data from the filters array or an array containing an empty string to make it safe for echoing out.
getPagelessPath ( ) : string Returns the current path without any page indicator. Useful for resetting sorting/filtering no matter which page the user is on.
getSortData ( ) : array Returns an array of sanitized sort data for the view.

Method Details

__construct() public method

public __construct ( integer $categoryID, string $selectedSort = '', array $selectedFilters = [] )
$categoryID integer The ID of the category we're in.
$selectedSort string The selected sort.
$selectedFilters array The selected filters.

getFilterDropdowns() protected method

Returns an array of dropdown menus with the data from the filters array or an array containing an empty string to make it safe for echoing out.
protected getFilterDropdowns ( ) : array
return array An array of dropdown menus or an array containing an empty string.

getPagelessPath() protected method

Returns the current path without any page indicator. Useful for resetting sorting/filtering no matter which page the user is on.
protected getPagelessPath ( ) : string
return string The path of the request without the page.

getSortData() protected method

(Data uses no rendering module and must be manually inserted into the view.)
protected getSortData ( ) : array
return array An array of sorts consisting of the name, url, rel and cssClass of each sort item.

prepare() public method

Checks whether we should even render this whole thing.
public prepare ( ) : boolean
return boolean Whether to render the module.

setDropdownView() public method

public setDropdownView ( string $dropdownView ) : DiscussionsSortFilterModule
$dropdownView string The view of the dropdown module to render.
return DiscussionsSortFilterModule $this

setShowFilters() public method

public setShowFilters ( $showFilters ) : DiscussionsSortFilterModule
$showFilters Whether to show the filtering options in the view.
return DiscussionsSortFilterModule $this

setShowSorts() public method

public setShowSorts ( $showSorts ) : DiscussionsSortFilterModule
$showSorts Whether to show the sorting options in the view.
return DiscussionsSortFilterModule $this

showFilters() public method

public showFilters ( ) : boolean
return boolean Whether to show the filtering options in the view.

showSorts() public method

public showSorts ( ) : boolean
return boolean Whether to show the sorting options in the view.

Property Details

$categoryID protected_oe property

The ID of the category we're in.
protected $categoryID

$dropdownView protected_oe property

The view of the dropdown module to render.
protected $dropdownView

$filters protected_oe property

The filters to render.
protected $filters

$selectedFilters protected_oe property

The selected filters.
protected $selectedFilters

$selectedSort protected_oe property

The selected sort.
protected $selectedSort

$showFilters protected_oe property

Whether to show the filter options in the view.
protected $showFilters

$showSorts protected_oe property

Whether to show the sorting options in the view.
protected $showSorts

$sorts protected_oe property

The sorts to render.
protected $sorts