Elgg
Version 4.3
|
Public Member Functions | |
__construct (PluginHooksService $hooks, HttpRequest $request) | |
Constructor. More... | |
setViewtype ($viewtype= '') | |
Set the viewtype. More... | |
getViewtype () | |
Get the viewtype. More... | |
clampViewtypeToPopulatedViews () | |
If the current viewtype has no views, reset it to "default". More... | |
isValidViewtype ($viewtype) | |
Checks if $viewtype is a string suitable for use as a viewtype name. More... | |
autoregisterViews ($view_base, $folder, $viewtype) | |
Auto-registers views from a location. More... | |
findViewFile ($view, $viewtype) | |
Find the view file. More... | |
setViewDir ($view, $location, $viewtype= '') | |
Set an alternative base location for a view. More... | |
registerViewtypeFallback ($viewtype) | |
Register a viewtype to fall back to a default view if a view isn't found for that viewtype. More... | |
doesViewtypeFallback ($viewtype) | |
Checks if a viewtype falls back to default. More... | |
renderDeprecatedView ($view, array $vars, $suggestion, $version) | |
Display a view with a deprecation notice. More... | |
getViewList ($view) | |
Get the views, including extensions, used to render a view. More... | |
renderView ($view, array $vars=[], $viewtype= '', $issue_missing_notice=true, array $extensions_tree=[]) | |
Renders a view. More... | |
viewExists ($view, $viewtype= '', $recurse=true) | |
Returns whether the specified view exists. More... | |
extendView ($view, $view_extension, $priority=501) | |
Extends a view with another view. More... | |
viewIsExtended ($view) | |
Is the given view extended? More... | |
viewHasHookHandlers ($view) | |
Do hook handlers exist to modify the view? More... | |
unextendView ($view, $view_extension) | |
Unextends a view. More... | |
registerCacheableView ($view) | |
Register a view a cacheable. More... | |
isCacheableView ($view) | |
Is the view cacheable. More... | |
registerPluginViews ($path) | |
Register a plugin's views. More... | |
mergeViewsSpec (array $spec) | |
Merge a specification of absolute view paths. More... | |
listViews ($viewtype= 'default') | |
List all views in a viewtype. More... | |
getInspectorData () | |
Get inspector data. More... | |
configureFromCache (SystemCache $cache) | |
Configure locations from the cache. More... | |
cacheConfiguration (SystemCache $cache) | |
Cache the configuration. More... | |
Static Public Member Functions | |
static | canonicalizeViewName ($alias) |
Takes a view name and returns the canonical name for that view. More... | |
Public Attributes | |
const | VIEW_HOOK = 'view' |
const | VIEW_VARS_HOOK = 'view_vars' |
const | OUTPUT_KEY = '__view_output' |
const | BASE_VIEW_PRIORITY = 500 |
Protected Member Functions | |
fileExists ($path) | |
Wrapper for file_exists() that caches false results (the stat cache only caches true results). More... | |
Protected Attributes | |
$file_exists_cache = [] | |
Views service.
Definition at line 18 of file ViewsService.php.
Elgg\ViewsService::__construct | ( | PluginHooksService | $hooks, |
HttpRequest | $request | ||
) |
Constructor.
PluginHooksService | $hooks | The hooks service |
\Elgg\Http\Request | $request | Http Request |
Definition at line 92 of file ViewsService.php.
Elgg\ViewsService::autoregisterViews | ( | $view_base, | |
$folder, | |||
$viewtype | |||
) |
Auto-registers views from a location.
string | $view_base | Optional The base of the view name without the view type. |
string | $folder | Required The folder to begin looking in |
string | $viewtype | The type of view we're looking at (default, rss, etc) |
Definition at line 225 of file ViewsService.php.
Elgg\ViewsService::cacheConfiguration | ( | SystemCache | $cache | ) |
Cache the configuration.
SystemCache | $cache | The system cache |
Definition at line 848 of file ViewsService.php.
|
static |
Takes a view name and returns the canonical name for that view.
string | $alias | The possibly non-canonical view name. |
Definition at line 191 of file ViewsService.php.
Elgg\ViewsService::clampViewtypeToPopulatedViews | ( | ) |
If the current viewtype has no views, reset it to "default".
Definition at line 137 of file ViewsService.php.
Elgg\ViewsService::configureFromCache | ( | SystemCache | $cache | ) |
Configure locations from the cache.
SystemCache | $cache | The system cache |
Definition at line 825 of file ViewsService.php.
Elgg\ViewsService::doesViewtypeFallback | ( | $viewtype | ) |
Checks if a viewtype falls back to default.
string | $viewtype | Viewtype |
Definition at line 337 of file ViewsService.php.
Elgg\ViewsService::extendView | ( | $view, | |
$view_extension, | |||
$priority = 501 |
|||
) |
Extends a view with another view.
string | $view | The view to extend. |
string | $view_extension | This view is added to $view |
int | $priority | The priority, from 0 to 1000, to add at (lowest numbers displayed first) |
Definition at line 583 of file ViewsService.php.
|
protected |
Wrapper for file_exists() that caches false results (the stat cache only caches true results).
This saves us from many unneeded file stat calls when a common view uses a fallback.
string | $path | Path to the file |
Definition at line 478 of file ViewsService.php.
Elgg\ViewsService::findViewFile | ( | $view, | |
$viewtype | |||
) |
Find the view file.
string | $view | View name |
string | $viewtype | Viewtype |
Definition at line 276 of file ViewsService.php.
Elgg\ViewsService::getInspectorData | ( | ) |
Elgg\ViewsService::getViewList | ( | $view | ) |
Get the views, including extensions, used to render a view.
Keys returned are view priorities. View existence is not checked.
string | $view | View name |
Definition at line 373 of file ViewsService.php.
Elgg\ViewsService::getViewtype | ( | ) |
Elgg\ViewsService::isCacheableView | ( | $view | ) |
Is the view cacheable.
string | $view | the view name |
Definition at line 678 of file ViewsService.php.
Elgg\ViewsService::isValidViewtype | ( | $viewtype | ) |
Checks if $viewtype is a string suitable for use as a viewtype name.
string | $viewtype | Potential viewtype name. Alphanumeric chars plus _ allowed. |
Definition at line 172 of file ViewsService.php.
Elgg\ViewsService::listViews | ( | $viewtype = 'default' | ) |
List all views in a viewtype.
string | $viewtype | Viewtype |
Definition at line 787 of file ViewsService.php.
Elgg\ViewsService::mergeViewsSpec | ( | array | $spec | ) |
Merge a specification of absolute view paths.
array | $spec | Specification viewtype => [ view_name => path or array of paths ] |
Definition at line 754 of file ViewsService.php.
Elgg\ViewsService::registerCacheableView | ( | $view | ) |
Register a view a cacheable.
string | $view | the view name |
Definition at line 665 of file ViewsService.php.
Elgg\ViewsService::registerPluginViews | ( | $path | ) |
Register a plugin's views.
string | $path | Base path of the plugin |
Definition at line 714 of file ViewsService.php.
Elgg\ViewsService::registerViewtypeFallback | ( | $viewtype | ) |
Register a viewtype to fall back to a default view if a view isn't found for that viewtype.
string | $viewtype | The viewtype to register |
Definition at line 326 of file ViewsService.php.
Elgg\ViewsService::renderDeprecatedView | ( | $view, | |
array | $vars, | ||
$suggestion, | |||
$version | |||
) |
Display a view with a deprecation notice.
No missing view NOTICE is logged
string | $view | The name and location of the view to use |
array | $vars | Variables to pass to the view |
string | $suggestion | Suggestion with the deprecation message |
string | $version | Human-readable release version: 1.7, 1.8, ... |
Definition at line 353 of file ViewsService.php.
Elgg\ViewsService::renderView | ( | $view, | |
array | $vars = [] , |
||
$viewtype = '' , |
|||
$issue_missing_notice = true , |
|||
array | $extensions_tree = [] |
||
) |
Renders a view.
string | $view | Name of the view |
array | $vars | Variables to pass to the view |
string | $viewtype | Viewtype to use |
bool | $issue_missing_notice | Should a missing notice be issued |
array | $extensions_tree | Array of views that are before the current view in the extension path |
Definition at line 394 of file ViewsService.php.
Elgg\ViewsService::setViewDir | ( | $view, | |
$location, | |||
$viewtype = '' |
|||
) |
Set an alternative base location for a view.
string | $view | Name of the view |
string | $location | Full path to the view file |
string | $viewtype | The viewtype to register this under |
Definition at line 300 of file ViewsService.php.
Elgg\ViewsService::setViewtype | ( | $viewtype = '' | ) |
Set the viewtype.
string | $viewtype | Viewtype |
Definition at line 104 of file ViewsService.php.
Elgg\ViewsService::unextendView | ( | $view, | |
$view_extension | |||
) |
Unextends a view.
string | $view | The view that was extended. |
string | $view_extension | This view that was added to $view |
Definition at line 637 of file ViewsService.php.
Elgg\ViewsService::viewExists | ( | $view, | |
$viewtype = '' , |
|||
$recurse = true |
|||
) |
Returns whether the specified view exists.
string | $view | The view name |
string | $viewtype | If set, forces the viewtype |
bool | $recurse | If false, do not check extensions |
Definition at line 534 of file ViewsService.php.
Elgg\ViewsService::viewHasHookHandlers | ( | $view | ) |
Do hook handlers exist to modify the view?
string | $view | View name |
Definition at line 623 of file ViewsService.php.
Elgg\ViewsService::viewIsExtended | ( | $view | ) |
Is the given view extended?
string | $view | View name |
Definition at line 612 of file ViewsService.php.
|
protected |
Definition at line 31 of file ViewsService.php.
const Elgg\ViewsService::BASE_VIEW_PRIORITY = 500 |
Definition at line 25 of file ViewsService.php.
const Elgg\ViewsService::OUTPUT_KEY = '__view_output' |
Definition at line 24 of file ViewsService.php.
const Elgg\ViewsService::VIEW_HOOK = 'view' |
Definition at line 22 of file ViewsService.php.
const Elgg\ViewsService::VIEW_VARS_HOOK = 'view_vars' |
Definition at line 23 of file ViewsService.php.