New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support xdebug.file_link_format For Views #580

zschuessler opened this Issue Dec 30, 2016 · 1 comment


None yet
1 participant
Copy link

zschuessler commented Dec 30, 2016

xdebug.file_link_format allows users to set a handler for opening file paths in their IDE. It is used in the Symfony Exception package so a user may click on any file and open it for editing automatically.

Using this handler in the rendered view list would be extremely handy!

An example of how this could be implemented is below:


public function addView(View $view)
        $name = $view->getName();
        $path = $view->getPath();
        $fileLinkFormat = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');

        if (!is_object($path)) {
            if ($path) {
                $path = ltrim(str_replace(base_path(), '', realpath($path)), '/');

            if (substr($path, -10) == '.blade.php') {
                $type = 'blade';
            } else {
                $type = pathinfo($path, PATHINFO_EXTENSION);
        } else {
            $type = get_class($view);
            $path = '';

        if (!$this->collect_data) {
            $params = array_keys($view->getData());
        } else {
            $data = [];
            foreach ($view->getData() as $key => $value) {
                $data[$key] = $this->exporter->exportValue($value);
            $params = $data;

        if ($fileLinkFormat) {
            $link = strtr(($fileLinkFormat), array('%f' => $view->getPath(), '%l' => 0));
            $path = sprintf('<a href="%s" title="Go to source">%s</a>', $link, $path);

        $this->templates[] = [
            'name' => $path ? sprintf('%s (%s)', $name, $path) : $name,
            'param_count' => count($params),
            'params' => $params,
            'type' => $type,

Note that I added the $fileLinkFormat variable, as well as the if branch to create the link if it exists in the user's config. (This is very similar to how the Symfony Exception component does it)

Note that as-is, the html is escaped so it renders the html as text, not a link. Just a proof of concept to get ideas on an implementation going.



This comment has been minimized.

Copy link

zschuessler commented Jan 18, 2017

Looks like this is fixed with this PR:


Can be closed if this gets merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment