context is not normally set now for node tabs other than 'View' and 'Edit' ('Revisions', for instance) when i'm looking at a node of the type i selected. from what i can tell, it's because the only nodeapi op is 'load'.

i'm wondering if anyone has ideas about the best way to go about overriding that. right now, i am doing it with a nodeapi hook function in my own module, on 'load' op calls, that checks the node type and then the current path to see if it looks like "node/this-node-nid-value" using arg().

Comments

firelad’s picture

Brad, would you please explain in more detail what you do to fix this, and how to duplicate it? I'm not a coder, so I can't really figure it out from your brief explanation.

Many thanks,
Marc.

brad.bulger’s picture

this probably won't be all that much clearer :) but i'll give it a shot.

i'm using the context as part of a feature module created by the Features module.

i edited the module file created for the feature and added an implementation of hook_nodeapi, like this:

function mymodule_nodeapi(&$node, $op, $a3, $a4) {
  if ($node->type == 'my_content_type') {
    $args = arg();
    switch ($op) {
      case 'load':
        // context itself only runs on 'view'
        if ($args[0] == 'node' and $args[1] == $node->nid) {
          context_set('mycontext_namespace','mycontext_attribute','mycontext');
        }
        break;
    }
  }
}

that works well enough for what i'm doing but i'd expect there has to be a better real solution.

steven jones’s picture

Category: support » feature
Status: Active » Postponed

If you wanted to add this functionality generally the you would need to implement a hook_context_conditions and provide the various node ops, then implement a slight modification of the code above to set any contexts based on those ops.

steven jones’s picture

Status: Postponed » Closed (won't fix)

No more features for the 2.x branch I'm afraid.