drupal twig override template variables code example
Example: drupal 8 suggestions
function MYMODULE_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
if (\Drupal::currentUser()
->isAuthenticated() && in_array($hook, array(
'node',
'taxonomy_term',
))) {
$suggestions[] = $hook . '__' . 'logged_in';
}
}