[development] MENU_LOCAL_TASK for just some node types

Lluís enboig at gmail.com
Thu Jun 5 15:30:55 UTC 2008


It works prefectly, thanks a lot.

On Thu, Jun 5, 2008 at 5:02 PM, Saint-Genest Gwenael
<gwenael.saint-genest at makina-corpus.com> wrote:
> Hi,
>
>  You can use node_load() to get node type attribute.
>
> function comptacau_project_menu($may_cache) {
>  $items=array();
>  if (arg(0) == 'node' && is_numeric(arg(1))) {
>      $node = node_load(arg(1));
>      // DEBUG: Example with 'page' but can be anything else ...
>      if ($node->type == 'page') {
>        $items[] = array(
>          'path' => 'node/'. arg(1) . '/pressupost_form',
>          'title' => t('Pressupost'),
>          'callback' => 'devel_load_object',
>          'callback arguments' => array($node),
>          'access' => user_access('access devel information'),
>          'type' => MENU_LOCAL_TASK
>        );
>      }
>  }
>  return $items;
> }
>
> G. Saint-Genest
>
> --
> Gwenael Saint-Genest
> MAKINA CORPUS - www.makina-corpus.com
> 44 boulevard des Pas Enchantés FR-44230 Saint Sébastien sur Loire
> Tel : +33 (0) 2 40 94 96 08
>



-- 
*La felicitat ha de ser compatible, compartible i cooperativa.
*Envellim quan els records superen les esperances.
*Als llocs desconeguts només s'hi arriba per camins desconeguts.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.


More information about the development mailing list