cableman/ding-wiki — comment on commit 8ca42c3e8e46b7e039d50876d1808a1679056af8
File: ding_wiki.module line 165
By kasperg:

`$vars['node']` will be set when preprocessing a content field even though it is not shown as part of the node view.

I've tried to add a few comments to where you started.

```php
if ($vars['node_type'] == 'wiki_page') {
// So we only get here if we are preprocessing a field for a wiki page node

$vars['wiki_gallery'] = (arg(2) == 'wiki_gallery') !== FALSE; //wiki_gallery is true for node/nid/wiki_gallery

$vars['wiki_page'] = FALSE;
if ((arg(0) == 'node') && is_int(arg(1)) && !arg(2)) {
// path is node/nid
$node = node_load(arg(1));
$vars['wiki_page'] = $node->type == 'wiki_page'; // Content field is being shown on node/nid where the node is a wiki_page.
}
)
```

The effect of the control statement should be:

Wiki gallery page `node\nid\wiki_gallery`: `$vars['wiki_gallery'] = true; $vars['wiki_page] = false;`
Wiki page `node\nid`: `$vars['wiki_page] = true; $vars['wiki_gallery'] = false;`
All other pages: `$vars['wiki_gallery'] = $vars['wiki_page] = false;`