Domanda

Devo aggiungere una voce di menu con il seguente link: User / 16 / Indirizzi

È il collegamento a una scheda di profili utente.Naturalmente 16 è l'ID utente e dovrebbe cambiare in base all'utente.

Posso usare token direttamente in voci di menu?come [UID]?

Grazie

È stato utile?

Soluzione

Hook_Menu () La maggior parte del lavoro per te con questo.

function example_menu() {
  return array(
  'user/%/addressess' => array(
      'title' => 'User Addresses',
      'page callback' => 'example_callback',
      'page arguments' => array(1),
      'weight' => 2,
      'type' => MENU_LOCAL_TASK,
    ),
  );
 }
.

Questo aggiungerà la scheda quando si è in una pagina utente e inserirà l'UID nell'URL.

Come capisco il menu_Local_Task funziona dall'URL corrente, quindi non è possibile sostituire un altro ID utente nel menu con questo.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top