function menu_position_menu_position_condition_content_type in Menu Position 6
Same name and namespace in other branches
- 7.2 plugins/menu_position.content_type.inc \menu_position_menu_position_condition_content_type()
- 7 plugins/menu_position.content_type.inc \menu_position_menu_position_condition_content_type()
Checks if the node is of a certain type.
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.content_type.inc, line 16 - Provides the "Content type" rule plugin for the Menu Position module.
Code
function menu_position_menu_position_condition_content_type($variables) {
// Grab the variables stored statically in the rule.
$content_type = $variables['content_type'];
// $node is dynamically added and may not exist.
$node = isset($variables['context']['node']) ? $variables['context']['node'] : NULL;
return $node && in_array($node->type, $content_type) ? TRUE : FALSE;
}