I'm trying to get a module path with twig in a views field rewrite like this:

{{ url('module.my_module') }}

can't find any hints how to do this on https://www.drupal.org/node/2486991

Comments

rolodmonkey’s picture

What are you trying to do? What files from your module do you want to include?

There are specific, secure ways to include JavaScript, CSS, et al.

--

Read more at iRolo.net

h_dries’s picture

I'm trying to include a couple of images (icons), that are inside my module folder

rolodmonkey’s picture

I would try to do this not in the twig file, but in the theme preprocessor. Something like this:

'#uri' => drupal_get_path('module', 'system') . '/images/no_screenshot.png'

Which can be found here: https://api.drupal.org/api/drupal/core%21modules%21system%21system.admin...

--

Read more at iRolo.net