1

If I keep my plugin class in the mymodule.module, then the plugin works fine. However moving it out to mymodule.context.condition.inc prevents the condition from working.

I have added file[] entry to mymodule.info and I have added the following to my hook_context_plugins:

function mymodule_context_plugins() {
  $plugins = array();
  $plugins['mymodule_context_condition_bonus_discount'] = array(
    'handler' => array(
      'class' => 'mymodule_context_condition_bonus_discount',
      'parent' => 'context_condition',
      'path' => drupal_get_path('module', 'mymodule'),
      'file' => 'mymodule.context.condition.inc',
    ),
  );
  return $plugins;
}

As mentioned, if I shift the code into the .module file, and remove the 'path' and 'file' lines from hook_context_plugins, then the condition is recognized by context and runs without issue.

SOLVED:

Looks like my class definition should not have had a capital "C" in "Class". Quite frustrating since I'm using drupalcs which complains about the lower case "class".

1

Looks like my class definition should not have had a capital "C" in "Class". Quite frustrating since I'm using drupalcs which complains about the lower case "class".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.