question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Twig] Global PhpTypes for all files

See original GitHub issue

I would like to see a way to define global PhpTypes for my entire project.

I’m using Craft CMS so there is no real way to access the Twig config without overwriting things and I would like to define

{# @var variable_name \Foo\Bar #}

only once and use this variable in all templates. Currently the first line of all my templates is {# @var craft \Craft\CraftVariable #} it would be better to type that only once somewhere and use it everywhere.

Is there a way to do this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
khalwatcommented, Mar 18, 2019
1reaction
Anubarakcommented, Dec 27, 2017

Thank you so much, this is perfect 😄 Guten Rutsch in das neue Jahr 😛

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Inject Variables Automatically into all Templates
Twig allows you to automatically inject one or more variables into all templates. These global variables are defined in the twig.globals option inside...
Read more >
service method as twig global variable - php - Stack Overflow
Use it a Twig file ... One approach is use a CONTROLLER event listener. I like to use CONTROLLER instead of REQUEST because...
Read more >
Twig - SlideShare
This is the documentation for Twig, the flexible, fast, and secure template engine for PHP. Viewed by www.thanh.ch.
Read more >
En.json
Users can also String data by uploading the file. A specification for building APIs in JSON. The editor offers all your need in...
Read more >
How to Inject Variables into all Templates (i.e. global Variables)
This is possible inside your app/config/config.yml file: YAML. # app/config/config.yml twig: # ... globals: ga_tracking: UA-xxxxx-x.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found