Elgg
Version 6.1
|
Public Member Functions | |
__construct (protected EventsService $events, protected HttpRequest $request, protected Config $config, protected ServerCache $server_cache) | |
Constructor. More... | |
setViewtype (string $viewtype= '') | |
Set the viewtype. More... | |
getViewtype () | |
Get the viewtype. More... | |
isValidViewtype (string $viewtype) | |
Checks if $viewtype is a string suitable for use as a viewtype name. More... | |
registerCoreViews () | |
Discover the core views if the system cache did not load. More... | |
autoregisterViews (string $view_base, string $folder, string $viewtype) | |
Auto-registers views from a location. More... | |
findViewFile (string $view, string $viewtype) | |
Find the view file. More... | |
registerViewtypeFallback (string $viewtype) | |
Register a viewtype to fall back to a default view if a view isn't found for that viewtype. More... | |
doesViewtypeFallback (string $viewtype) | |
Checks if a viewtype falls back to default. More... | |
renderDeprecatedView (string $view, array $vars, string $suggestion, string $version) | |
Display a view with a deprecation notice. More... | |
getViewList (string $view) | |
Get the views, including extensions, used to render a view. More... | |
renderView (string $view, array $vars=[], string $viewtype= '', bool $issue_missing_notice=null, array $extensions_tree=[]) | |
Renders a view. More... | |
viewExists (string $view, string $viewtype= '', bool $recurse=true) | |
Returns whether the specified view exists. More... | |
extendView (string $view, string $view_extension, int $priority=501) | |
Extends a view with another view. More... | |
unextendView (string $view, string $view_extension) | |
Unextends a view. More... | |
registerViewsFromPath (string $path) | |
Register all views in a given path. More... | |
mergeViewsSpec (array $spec) | |
Merge a specification of absolute view paths. More... | |
listViews (string $viewtype= 'default') | |
List all views in a viewtype. More... | |
getInspectorData () | |
Get inspector data. More... | |
configureFromCache () | |
Configure locations from the cache. More... | |
cacheConfiguration () | |
Cache the configuration. More... | |
isViewLocationsLoadedFromCache () | |
Checks if view_locations have been loaded from cache. More... | |
getESModules () | |
Returns an array of names of ES modules detected based on view location. 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 | |
resolveViewtype () | |
Resolve the initial viewtype. More... | |
fileExists (string $path) | |
Wrapper for file_exists() that caches false results (the stat cache only caches true results). More... | |
renderViewFile (string $view, array $vars, string $viewtype, bool $issue_missing_notice) | |
Includes view PHP or static file. More... | |
setViewLocation (string $view, string $viewtype, string $path) | |
Update the location of a view file. More... | |
Protected Attributes | |
array | $file_exists_cache = [] |
array | $locations = [] |
[viewtype][view] => '/path/to/views/style.css' More... | |
array | $overrides = [] |
Tracks location changes for views. More... | |
array | $extensions = [] |
[view][priority] = extension_view More... | |
array | $fallbacks = [] |
string | $viewtype |
bool | $locations_loaded_from_cache = false |
Views service.
Definition at line 16 of file ViewsService.php.
Elgg\ViewsService::__construct | ( | protected EventsService | $events, |
protected HttpRequest | $request, | ||
protected Config | $config, | ||
protected ServerCache | $server_cache | ||
) |
Constructor.
EventsService | $events | Events service |
\Elgg\Http\Request | $request | Http Request |
\Elgg\Config | $config | Elgg configuration |
ServerCache | $server_cache | Server cache |
Definition at line 64 of file ViewsService.php.
Elgg\ViewsService::autoregisterViews | ( | string | $view_base, |
string | $folder, | ||
string | $viewtype | ||
) |
Auto-registers views from a location.
string | $view_base | 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 188 of file ViewsService.php.
Elgg\ViewsService::cacheConfiguration | ( | ) |
Elgg\ViewsService::configureFromCache | ( | ) |
Elgg\ViewsService::doesViewtypeFallback | ( | string | $viewtype | ) |
Checks if a viewtype falls back to default.
string | $viewtype | Viewtype |
Definition at line 252 of file ViewsService.php.
Elgg\ViewsService::extendView | ( | string | $view, |
string | $view_extension, | ||
int | $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 485 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 383 of file ViewsService.php.
Elgg\ViewsService::findViewFile | ( | string | $view, |
string | $viewtype | ||
) |
Find the view file.
string | $view | View name |
string | $viewtype | Viewtype |
Definition at line 221 of file ViewsService.php.
Elgg\ViewsService::getESModules | ( | ) |
Returns an array of names of ES modules detected based on view location.
Definition at line 689 of file ViewsService.php.
Elgg\ViewsService::getInspectorData | ( | ) |
Elgg\ViewsService::getViewList | ( | string | $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 286 of file ViewsService.php.
Elgg\ViewsService::getViewtype | ( | ) |
Elgg\ViewsService::isValidViewtype | ( | string | $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 136 of file ViewsService.php.
Elgg\ViewsService::isViewLocationsLoadedFromCache | ( | ) |
Checks if view_locations have been loaded from cache.
This can be used to determine if there is a need to (re)load view locations
Definition at line 680 of file ViewsService.php.
Elgg\ViewsService::listViews | ( | string | $viewtype = 'default' | ) |
List all views in a viewtype.
string | $viewtype | Viewtype |
Definition at line 609 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 578 of file ViewsService.php.
Elgg\ViewsService::registerCoreViews | ( | ) |
Discover the core views if the system cache did not load.
Definition at line 154 of file ViewsService.php.
Elgg\ViewsService::registerViewsFromPath | ( | string | $path | ) |
Register all views in a given path.
string | $path | Base path to scan for views |
Definition at line 539 of file ViewsService.php.
Elgg\ViewsService::registerViewtypeFallback | ( | string | $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 241 of file ViewsService.php.
Elgg\ViewsService::renderDeprecatedView | ( | string | $view, |
array | $vars, | ||
string | $suggestion, | ||
string | $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 268 of file ViewsService.php.
Elgg\ViewsService::renderView | ( | string | $view, |
array | $vars = [] , |
||
string | $viewtype = '' , |
||
bool | $issue_missing_notice = null , |
||
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 303 of file ViewsService.php.
|
protected |
Includes view PHP or static file.
string | $view | The view name |
array | $vars | Variables passed to view |
string | $viewtype | The viewtype |
bool | $issue_missing_notice | Log a notice if the view is missing |
Definition at line 401 of file ViewsService.php.
|
protected |
|
protected |
Update the location of a view file.
string | $view | View name |
string | $viewtype | Viewtype |
string | $path | File path |
Definition at line 718 of file ViewsService.php.
Elgg\ViewsService::setViewtype | ( | string | $viewtype = '' | ) |
Set the viewtype.
string | $viewtype | Viewtype |
Definition at line 79 of file ViewsService.php.
Elgg\ViewsService::unextendView | ( | string | $view, |
string | $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 514 of file ViewsService.php.
Elgg\ViewsService::viewExists | ( | string | $view, |
string | $viewtype = '' , |
||
bool | $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 439 of file ViewsService.php.
|
protected |
[view][priority] = extension_view
Definition at line 45 of file ViewsService.php.
|
protected |
Definition at line 50 of file ViewsService.php.
|
protected |
Definition at line 28 of file ViewsService.php.
|
protected |
[viewtype][view] => '/path/to/views/style.css'
Definition at line 33 of file ViewsService.php.
|
protected |
Definition at line 54 of file ViewsService.php.
|
protected |
Tracks location changes for views.
[viewtype][view][] => '/path/to/views/style.css'
Definition at line 40 of file ViewsService.php.
|
protected |
Definition at line 52 of file ViewsService.php.
const Elgg\ViewsService::BASE_VIEW_PRIORITY = 500 |
Definition at line 23 of file ViewsService.php.
const Elgg\ViewsService::OUTPUT_KEY = '__view_output' |
Definition at line 22 of file ViewsService.php.
const Elgg\ViewsService::VIEW_HOOK = 'view' |
Definition at line 20 of file ViewsService.php.
const Elgg\ViewsService::VIEW_VARS_HOOK = 'view_vars' |
Definition at line 21 of file ViewsService.php.