You are here

function fasttoggle_field_node_view in Fasttoggle 7

Implements hook_node_view_alter().

File

module/fasttoggle_field/fasttoggle_field.module, line 278

Code

function fasttoggle_field_node_view($node, $view_mode) {
  if ($view_mode == 'rss') {
    return;
  }
  $options = fasttoggle_get_allowed_links('node', $node, $node->nid, "fasttoggle_add_to_node_links");
  $label_style = variable_get('fasttoggle_label_style', FASTTOGGLE_LABEL_STATUS);
  $links = array_flip(variable_get('fasttoggle_add_to_node_links_' . $node->type, array()));
  if (!empty($options['fields'])) {
    foreach ($options['fields'] as $group => $flags) {
      if ($group != $node->type) {
        continue;
      }
      if (!empty($flags['instances'])) {
        foreach ($flags['instances'] as $instance => $data) {
          $key = "{$group}_{$instance}";
          if (array_key_exists($key, $links)) {
            $node->content['links']['node']['#links']['fasttoggle_' . $key] = fasttoggle($options, $group, $instance, $node, FASTTOGGLE_FORMAT_LINK_ARRAY);
          }
        }
      }
    }
  }
}