{{ base_path }}
{{ directory }}
{{ base_path ~ directory }}
<img src="{{ base_path ~ directory }}/img/image.svg" />
/**
* Implements hook_preprocess().
*/
function mytheme_preprocess(array &$variables, $hook) {
$variables['base_path'] = base_path();
}
You can use {{ active_theme_path() }} to get the path to the active theme.
- https://www.electriccitizen.com/blog/twig-drupal-8-development-twig-templating-part-1
- https://www.electriccitizen.com/blog/twig-drupal-8-development-twig-templating-part-2
Print Set Messages
drupal_set_message(t('Here is an external link to <a href="http://google.com">Google.</a>'), 'status');