Navigation Menu

Skip to content

Commit

Permalink
global filters -> general
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 15, 2021
1 parent 90a3be9 commit e338dfb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cs/routing.texy
Expand Up @@ -327,10 +327,10 @@ Parametry `presenter`, `action` a `module` už mají předdefinované filtry, kt
takže třeba v případě presenteru píšeme `<presenter=ProductEdit>`, nikoliv `<presenter=product-edit>`.


Globální filtry
---------------
Obecné filtry
-------------

Vedle filtrů určených pro konkrétní parametry můžeme definovat též globální filtry, které obdrží asociativní pole všech parametrů, které mohou jakkoliv modifikovat a poté je vrátí. Globální filtry definujeme pod klíčem `null`.
Vedle filtrů určených pro konkrétní parametry můžeme definovat též obecné filtry, které obdrží asociativní pole všech parametrů, které mohou jakkoliv modifikovat a poté je vrátí. Obecné filtry definujeme pod klíčem `null`.

```php
use Nette\Routing\Route;
Expand All @@ -345,9 +345,9 @@ $router->addRoute('<presenter>/<action>', [
]);
```

Globální filtry dávají možnost upravit chování routy naprosto jakýmkoliv způsobem. Můžeme je použít třeba pro modifikaci parametrů na základě jiných parametrů. Například přeložení `<presenter>` a `<action>` na základě aktuální hodnoty parametru `<lang>`.
Obecné filtry dávají možnost upravit chování routy naprosto jakýmkoliv způsobem. Můžeme je použít třeba pro modifikaci parametrů na základě jiných parametrů. Například přeložení `<presenter>` a `<action>` na základě aktuální hodnoty parametru `<lang>`.

Pokud má parametr definovaný vlastní filtr a současně existuje globální filtr, provede se vlastní `FILTER_IN` před globálním a naopak globální `FILTER_OUT` před vlastním. Tedy uvnitř globálního filtru jsou hodnoty parametrů `presenter` resp. `action` zapsané ve stylu PascalCase resp. camelCase.
Pokud má parametr definovaný vlastní filtr a současně existuje obecný filtr, provede se vlastní `FILTER_IN` před obecným a naopak obecný `FILTER_OUT` před vlastním. Tedy uvnitř obecného filtru jsou hodnoty parametrů `presenter` resp. `action` zapsané ve stylu PascalCase resp. camelCase.


Jednosměrky ONE_WAY
Expand Down
10 changes: 5 additions & 5 deletions en/routing.texy
Expand Up @@ -327,10 +327,10 @@ The parameters `presenter`, `action` and `module` already have predefined filter
so, for example, in the case of a presenter, we write `<presenter=ProductEdit>` instead of `<presenter=product-edit>`.


Global Filters
--------------
General Filters
---------------

Besides filters for specific parameters, you can also define global filters that receive an associative array of all parameters that they can modify in any way and then return. Global filters are defined under `null` key.
Besides filters for specific parameters, you can also define general filters that receive an associative array of all parameters that they can modify in any way and then return. General filters are defined under `null` key.

```php
use Nette\Routing\Route;
Expand All @@ -345,9 +345,9 @@ $router->addRoute('<presenter>/<action>', [
]);
```

Global filters give you the ability to adjust the behavior of the route in absolutely any way. We can use them, for example, to modify parameters based on other parameters. For example, translation `<presenter>` and `<action>` based on the current value of parameter `<lang>`.
General filters give you the ability to adjust the behavior of the route in absolutely any way. We can use them, for example, to modify parameters based on other parameters. For example, translation `<presenter>` and `<action>` based on the current value of parameter `<lang>`.

If a parameter has a custom filter defined and a global filter exists at the same time, custom `FILTER_IN` is executed before the global and vice versa global `FILTER_OUT` is executed before the custom. Thus, inside the global filter are the values of the parameters `presenter` resp. `action` written in PascalCase resp. camelCase style.
If a parameter has a custom filter defined and a general filter exists at the same time, custom `FILTER_IN` is executed before the general and vice versa general `FILTER_OUT` is executed before the custom. Thus, inside the general filter are the values of the parameters `presenter` resp. `action` written in PascalCase resp. camelCase style.


ONE_WAY flag
Expand Down

0 comments on commit e338dfb

Please sign in to comment.