SilverStripe\CMS\Controllers\CMSSiteTreeFilter
Base class for filtering the subtree for certain node statuses.
The simplest way of building a CMSSiteTreeFilter is to create a pagesToBeShown() method that
returns an Iterator of maps, each entry containing the 'ID' and 'ParentID' of the pages to be
included in the tree. The result of a DB::query() can then be returned directly.
If you wish to make a more complex tree, you can overload includeInTree($page) to return true/
false depending on whether the given page should be included. Note that you will need to include
parent helper pages yourself.
Synopsis
class CMSSiteTreeFilter
implements
LeftAndMain_SearchFilter
{
- // members
- protected array $params = ;
- protected $_cache_ids = NULL;
- protected $_cache_highlight_ids = NULL;
- protected array $_cache_expanded = ;
- protected $childrenMethod = NULL;
- protected string $numChildrenMethod = 'numChildren';
- // methods
- public static array get_all_filters()
- public void __construct()
- public void getChildrenMethod()
- public void getNumChildrenMethod()
- public void getPageClasses()
- public abstract SS_List getFilteredPages()
- public array pagesIncluded()
- protected void populateIDs()
- public void isPageIncluded()
- protected DataList applyDefaultFilters()
- protected array mapIDs()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
Implements
- SilverStripe\Admin\LeftAndMain_SearchFilter
Members
protected
- $_cache_expanded — array
- $_cache_highlight_ids
—
array
Subset of $_cache_ids which include only items that appear directly in search results. - $_cache_ids
—
array
List of filtered items and all their parents - $childrenMethod — string
- $numChildrenMethod — string
- $params
—
array
Search parameters, mostly properties on {@link SiteTree}.
Methods
protected
- applyDefaultFilters() — Applies the default filters to a specified DataList of pages
- mapIDs() — Maps a list of pages to an array of associative arrays with ID and ParentID keys
- populateIDs() — Populate the IDs of the pages returned by pagesIncluded(), also including the necessary parent helper pages.
public
- __construct()
- getChildrenMethod()
- getFilteredPages() — Gets the list of filtered pages
- getNumChildrenMethod()
- getPageClasses()
- get_all_filters() — Returns a sorted array of all implementators of CMSSiteTreeFilter, suitable for use in a dropdown.
- isPageIncluded()
- pagesIncluded()