I’ve a query about getting a path to a picture in a Twig template. Drupal Development picture will not be assigned to a subject or one thing. Only a static picture which is saved in “MYTHEME/picture/icon/my-icon.png”.
In Drupal 7 I get Drupal Development Service path in my node.template with Drupal Development Service following code:
<img src="<?php print base_path() . path_to_theme(); ?>/picture/icons">/my-icon.png How does it work with in Drupal 8? I attempted to move a variable in template_preprocess_node().
MYTHEME.theme:
$variables['images_path'] = Drupal::theme()->getActiveTheme()->getPath() . '/picture/'; Twig template:
<img src="{{ images_path  ~ 'icons/' ~ 'my-icon.png' }}"> It would not work. There isn’t a PHP error, however Drupal Development Service path is wrongly mentioned to be http://localhost/node/themes/template/picture/icons/my-icon.png.



