PHP Трейт 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!
Показать файл
Открыть проект
Защищенные свойства (Protected)
Свойство |
Тип |
Описание |
|
$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'. |
|
Защищенные методы
Метод |
Описание |
|
onBeforeDispatch ( ) |
Transparently replaces old view names with their counterparts. |
|
Описание методов
onBeforeDispatch()
защищенный Метод
If you are overriding this method in your component remember to alias it and call it from your overridden method.
Описание свойств
$permanentAliasRedirectionOnGET защищенное свойство
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 |
Результат |
boolean |
|
$viewNameAliases защищенное свойство
Maps view name aliases to actual views. The format is 'alias' => 'RealView'.
protected array $viewNameAliases |
Результат |
array |
|