You are here

function twig_process_node in Twig Input Filter 7

Processes variables for node.tpl.php.

File

./twig.module, line 48

Code

function twig_process_node(&$vars) {
  if ($vars['view_mode'] == 'full') {
    $wrapper = entity_metadata_wrapper('node', $vars['node']);
    if (isset($wrapper->twig_template) && ($template = $wrapper->twig_template
      ->value())) {
      $context = _twig_extract_entity_fields($vars['content']);
      $vars['content'] = array(
        '#markup' => _twig_render($template, $context),
      );
      $vars['page'] = TRUE;
    }
  }
}