friendica / friendica-directory

Global directory for the Friendica project. The repository has moved to git.friendi.ca/friendica/friendica-directory
GNU Affero General Public License v3.0
20 stars 11 forks source link

Add zrl parameter support #41

Closed MrPetovan closed 4 years ago

MrPetovan commented 4 years ago

Closes #24

I've long wondered how to best support the zrl parameter within the Slim framework context. I was stuck for a while because I needed to find the intersection of the Request object that contains the query parameter, the Router to generate URLs for routes including the parameter, and the Renderer to append the parameter to external URLs (not handled by the internal router).

The solution was to use a midlleware class to extract the query string parameter from the request and store it as an attribute of the Renderer, then have the Router be a dependency of the Renderer, then write two Renderer helper methods to append automatically the zrl parameter to route URLs and external URLs repsectively.

Then I had to replace all the hard-coded URLs in the templates with either method calls.

In the end, it was easier than I initially expected, but it took me a while to wrap my head around the dependency injection philosophy I'm trying to use through Slim.

annando commented 4 years ago

91 files? Uff

AlfredSK commented 4 years ago

It's mostly the email change. :-)

MrPetovan commented 4 years ago

Yeah, going commit by commit is recommended.