2017-04-12 3 views
-2

Ich bin neu bei Drupal, ich habe ein benutzerdefiniertes Modul mit PHP, die Liste der Schüler mit Informationen zeigt, und klicken Sie auf den Menüpunkt Untermenü, benannt, Student Info. Bitte führen Sie Schritt für Schritt durch.So rufen Sie Custom Module in Drupal

+0

Willkommen bei Stack, Neetu! Bitte geben Sie uns einen Code und Beispiele, damit wir Ihnen bei Ihrer Frage helfen können. –

+1

Bitte lesen Sie die Dokumentation, bevor Sie auf stackoverflow https://www.drupal.org/docs//creating-custom-modules nachfragen – Fky

Antwort

1

Der Ausgangspunkt für die Generierung eines "Seitenrückrufs" (im Wesentlichen eine URL in Drupal aktiv) wäre hook_menu. Wie vorgeschlagen, werfen Sie einen Blick auf die Dokumentation, aber ein Ausgangspunkt, um Ihre Callback-Arbeit wirklich in einer my_module.module-Datei zu machen wäre:

/** 
* Implements hook_menu(). 
*/ 
function my_module__menu() { 
    $items = array(); 

    $items['student-info'] = array(
     'title' => 'Student Info', // This becomes the page title 
     'description' => 'Information about students.', // this is the link description 
     'page callback' => 'function_name_that_outputs_content', // this is the page callback function that will fire 
     'type' => MENU_CALLBACK, // this is the type of menu callback, there are several that you can use depending on what your needs are. 
    ); 

    return $items; // make sure you actually return the items. 
} 

/** 
* Output the page contents when someone visits http://example.com/student-info. 
*/ 
function function_name_that_outputs_content() { 
    $output = 'My page content' 

    return $output; 
}