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
Afficher le fichier Open project: vanilla/vanilla

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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 méthode

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
Résultat array An array of dropdown menus or an array containing an empty string.

getPagelessPath() protected méthode

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

getSortData() protected méthode

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

prepare() public méthode

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

setDropdownView() public méthode

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

setShowFilters() public méthode

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

setShowSorts() public méthode

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

showFilters() public méthode

public showFilters ( ) : boolean
Résultat boolean Whether to show the filtering options in the view.

showSorts() public méthode

public showSorts ( ) : boolean
Résultat 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