PHP Trait FOF30\Dispatcher\Mixin\ViewAliases
IMPORTANT: This is a mixin (or, as we call it in PHP, a trait). Traits require PHP 5.4 or later. If you opt to use
this trait your component will no longer work under PHP 5.3.
Usage:
• Override $viewNameAliases with your view names map.
• If you want to issue HTTP 301 for GET requests set $permanentAliasRedirectionOnGET to true.
• If you have an onBeforeDispatch method remember to alias and call this traits' onBeforeDispatch method at the top.
Regarding the last point, if you've never used traits before, the code looks like this. Top of the class:
use ViewAliases {
onBeforeDispatch as onBeforeDispatchViewAliases;
}
and inside your custom onBeforeDispatch method, the first statement should be:
$this->onBeforeDispatchViewAliases();
Simple!
显示文件
Open project: akeeba/fof
Protected Properties
Property |
Type |
Description |
|
$permanentAliasRedirectionOnGET |
boolean |
This does NOT apply to POST, PUT, DELETE etc URLs. When you submit form data you cannot have a redirection. The
browser will _typically_ not resend the submitted data. |
|
$viewNameAliases |
array |
Maps view name aliases to actual views. The format is 'alias' => 'RealView'. |
|
Protected Methods
Method |
Description |
|
onBeforeDispatch ( ) |
Transparently replaces old view names with their counterparts. |
|
Method Details
onBeforeDispatch()
protected method
If you are overriding this method in your component remember to alias it and call it from your overridden method.
Property Details
$permanentAliasRedirectionOnGET protected_oe property
This does NOT apply to POST, PUT, DELETE etc URLs. When you submit form data you cannot have a redirection. The
browser will _typically_ not resend the submitted data.
protected bool $permanentAliasRedirectionOnGET |
return |
boolean |
|
$viewNameAliases protected_oe property
Maps view name aliases to actual views. The format is 'alias' => 'RealView'.
protected array $viewNameAliases |
return |
array |
|