You are here

function HOOK_menu_position_condition_PLUGIN in Menu Position 7

Same name and namespace in other branches
  1. 6 plugins/menu_position.example_plugin.inc \HOOK_menu_position_condition_PLUGIN()
  2. 7.2 plugins/menu_position.example_plugin.inc \HOOK_menu_position_condition_PLUGIN()

Checks if [describe the type of functionality the plugin provides].

This is the condition callback that will be used when a rule is evaluated. If the condition was not added to the rule, this callback will not be called.

Parameters

$variables: An array containing each of the variables saved in the database necessary to evaluate this condition of the rule.

Return value

TRUE if condition applies successfully. Otherwise FALSE.

File

plugins/menu_position.example_plugin.inc, line 19
Provides the PLUGIN rule plugin for the Menu Position module.

Code

function HOOK_menu_position_condition_PLUGIN($variables) {

  // Grab the variables stored statically in the rule.
  $lolspeak = $variables['lolspeak'];

  // $node is dynamically added and may not exist.
  $node = isset($variables['context']['node']) ? $variables['context']['node'] : NULL;

  // Retrieve any extra data needed to determine the condition's result.
  // Business logic goes here.
  return $lolspeak && $node && $node->language == 'lolspeak' ? TRUE : FALSE;
}