Link in un sottomenù con un modulo

4 contenuti / 0 new
Ultimo contenuto
Link in un sottomenù con un modulo

Ciao a tutti,

so sviluppando un modulo ed ho necessità che alla sua installazione crei un link che stia sotto un menù già esistente...

In pratica ho un modulo che ha questo codice nell'hook_menu:

/**
* Implementation of hook_menu().
*/
function excel_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
  $items[] = array(
    'path' => 'mifid',
    'title' => t('mifid'),
    'callback' => 'excel_all',
    'access' => user_access('access content'),
    'type' => MENU_CALLBACK
  );
  }
  return $items;
}

Questo fa si che venga creato in automatico un link nel menù principale, ma mi servirebbe modificarlo in modo che metta invece un link "figlio" di un item del menù principale già presente...

Avete idee?

Spero di essermi fatto capire...

Grazie

Broken

Ho cercato un po' in giro e non credo che si possa fare. L'unica è che tu aggiungi dei comandi SQL al file .install del modulo, per cambiare manualmente la posizione del menu item.

Grazie comunque per l'aiuto ;)

Perchè no?

<?php
/**
 * Implementation of hook_menu().
 */
function drupalitalia_menu() {
 
$items = array();
 
$items['path'] = array(
   
'title'            => 'title',
   
'description'      => 'description',
   
'page callback'    => 'drupal_get_form',
   
'page arguments'   => array(''),
   
'access callback'  => '',
   
'access arguments' => array(''),
   
'weight'           => 0,
   
'menu_name'        => 'Navigation',
   
'type'             => MENU_NORMAL_ITEM,
  );
 
$items['path/children'] = array(
   
'title'            => 'title',
   
'description'      => 'description',
   
'page callback'    => 'drupal_get_form',
   
'page arguments'   => array(''),
   
'access callback'  => '',
   
'access arguments' => array(''),
   
'weight'           => 0,
   
'menu_name'        => 'Navigation',
   
'type'             => MENU_NORMAL_ITEM,
  );
  return
$items;
}
?>

Giocando con:

  • MENU_NORMAL_ITEM
  • MENU_SUGGESTED_ITEM
  • MENU_LOCAL_TASK
  • MENU_DEFAULT_LOCAL_TASK

Dovreste riuscire a farlo, ma forse non ho capito io la domanda :D

Ciao
Marco
--
My blog
Working at @agavee