Additional replacement patterns

Created on 16 February 2022, about 3 years ago
Updated 23 March 2025, 18 days ago

Problem/Motivation

I recently installed this module on a multi-site installation. I just received a screenshot of an error and it works beautifully, the only issue is, the user did not include the address bar (they often don't). As this is a multi-site setup, I didn't know which site the error was on, so it would be helpful to add a few more replacement patterns.

Proposed resolution

Extend ErrorPageRenderer to have a few more replacement patterns. Some examples helpful in my case:
{{ host }}
{{ request_uri }}
{{ request_method }}
{{ time }}

As I didn't know what would be available at the stage of the error, I simply used something quick and dirty, which won't work in everyone's case:

      $replacements = [
        # ...
        '{{ host }}' => $_SERVER['HTTP_HOST'],
        '{{ request_uri }}' => $_SERVER['REQUEST_URI'],
        '{{ request_method }}' => $_SERVER['REQUEST_METHOD'],
        '{{ time }}' => gmdate('Y-m-d H:i:s') . ' UTC',
      ];
Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany m-p-j

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024