List the available sites. This list can optionally be filtered by site name/title/description and/or site preset. This method uses a database query rather than using Lucene or Solr.
listSites(nameFilter, sitePresetFilter)
Parameters
- nameFilter
- String by which to filter the list of sites returned. Only sites whose cm:name or cm:title or cm:description start with the filter string will be returned.
- sitePresetFilter
- The site preset filter (sites whose preset EQUALS sitePresetFilter).
Returns
A list of the sites filtered, as appropriate. If no filters are specified then all the available sites are returned.
listSites(nameFilter, sitePresetFilter, size)
Parameters
- nameFilter
- String by which to filter the list of sites returned. Only sites whose cm:name or cm:title or cm:description starts with the filter string will be returned.
- sitePresetFilter
- The site preset filter.
- size
- The maximum number of sites to return. By default this is set to 0, which returns all results.
Returns
A list of the sites filtered, as appropriate. If no filters are specified then all the available sites are returned.
Example
The following code snippet would return all sites without any filtering or restriction on number of results returned:
var sites = siteService.listSites(null, null, 0);
The following code snippet would return all dashboard sites whose name, title or description starts with the text "test" and restricts the number of sites returned to 5:
var sites = siteService.listSites("test", null, 5);