Contextual menu link I'd like to know if it is possible to create a link only if a certain condition is respected.
Example with my current menu:

function mymodule_menu() {
  $items = array();
  $items['mycontent/%my_object/my_place'] = array(
     ---(code)---
  );
  return $items;
}


The link created by this menu should not be available for each instance of my_object. This menu should only be used by objects that have for example $my_object->flag set to TRUE.

In my page callback I could check the object and exit the form if the flag is not set, however the link would be still displayed and people could click on it.

Do you have any idea ? Thank you.
You can use an access callback for that sort of thing:

function mymodule_menu() {
  $items = array();
  $items['mycontent/%my_object/my_place'] = array( 
    'access callback' =&gt; 'mymodule_foo_access',
    'access arguments' =&gt; array(1),
    ...

  );
  return $items;
}

function mymodule_foo_access($object) {
  // Contrived example, use something better
  return $object-&gt;flag === TRUE;
}