I see that when I am creating a block through the drupal admin I can use PHP, in addition to plain text & html. Is there a variable in scope that I can use to access the node id?
<?php echo my_custom_function( $node_id, $my_desired_class); ?>
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can use the menu_get_object()
function which will get you the node object for the page, assuming of course your block is being displayed on a node page:
$node = menu_get_object();
if (isset($node->nid)) {
$nid = $node->nid;
echo my_custom_function($nid, $my_desired_class);
}