Opened 15 months ago
Last modified 13 months ago
#4412 new Documentation
Page handler nomenclature is confusing
| Reported by: | mrclay | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.x |
| Component: | Core | Version: | 1.8 |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description (last modified by ewinslow)
The PHPDoc for elgg_register_page_handler is clearest: "Registers a page handler for a particular identifier"; i.e. "discussion" is the identifier and "discussion_page_handler" is the handler (function), but confusingly the variable name $handler is used in many places to mean identifier.
I was surprised to find in page_handler(), route/$handler actually triggered route/discussion, not route/discussion_page_handler. Unfortunately, the identifier is passed to the hook handler under the key 'handler', so changing that could break BC, but renaming the local vars would help. What is also confusing is how the route hook is triggered passing $params in, but in your handler this is actually $returnvalue, not $params.
The "route" hook trigger should also probably be mentioned on the Engine/Controllers/PageHandler wiki page.
Change History (1)
comment:1 Changed 13 months ago by ewinslow
- Description modified (diff)
- Milestone changed from Needs Review to Elgg 1.8.x

Care to submit a PR?