[development] MENU_LOCAL_TASK for just some node types

Lluís enboig at gmail.com
Thu Jun 5 14:32:54 UTC 2008


My problem is there is no $node object to check $node->type. My menu
definition is:

function comptacau_project_menu() {
  $items=array();
  $items[] = array('path' => 'node/'. arg(1) .'/pressupost_form',
          'title' => t('Pressupost'),
          'callback' => 'devel_load_object',
          'callback arguments' => array('node', arg(1)),
          'access' => user_access('access devel information'),
          'type' => MENU_LOCAL_TASK,
        );
  return $items;
}


When I get it all working; I will check if this goes inside cache or outside

On Thu, Jun 5, 2008 at 4:17 PM, David Strauss <david at fourkitchens.com> wrote:
> I believe you mean *outside* of $may_cache.
>
> -----Original Message-----
> From: Michael Favia <michael at favias.org>
>
> Date: Thu, 05 Jun 2008 09:03:26
> To:development at drupal.org
> Subject: Re: [development] MENU_LOCAL_TASK for just some node types
>
>
> Lluís wrote:
>> I want to make avaliable a local menu for just some node types, how
>> can I achieve this?
>
> I think this is development related enough so here goes:
>
> Create a conditional menu item inside of if(!$may_cache) that tests the
> node->type against you desired nodes. This will prevent the LMT from
> always showing up. If you want to get fancy let the user select the
> allowable node types via a settings page and pull the data via
> variable_get(). This information applies to Drupal-5 but may be modified
> to apply to drupal 6. good luck.
>
> --
> Michael Favia                   michael at favias.org
> tel. 512.585.5650            http://www.favias.org
>



-- 
*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