Monday, April 9, 2012

How do you write anything on drupal framework page

as of now, what i have learnt in order to type or to display something onscreen are as follows:

  1. i can use command hook_help(). Need to pass 2 variables; eg buat_sendiri_help($path, $arg). In order to display something onscreen, i must use return *text*, otherwise nothing will be displayed.
  2. Use command hook_block_view(). need to pass a variable; eg buat_sendiri_block_view($delta=''). In this hook command, i need to assign the key name 'subject' and 'content'. Any assignments to those keynames (subject & content) will be displayed inside the block region. Same thing as hook_help(), i must return value at the end of the hook_block_view(). Anyway, the earlier step that must declared before using hook_block_view() is to use hook_block_info(); this is for declaration purpose where i assign the unique name of the block & some key name values. Eg of assigning unique block name is $block['buat_sendiri'].
  3. Use command drupal_get_form() where i need to pass a custom function name inside the brackets; eg drupal_get_form('buat_sendiri_contents'). However, inside my tutorial, the way of the coding calls drupal_get_form() is via another hook function called hook_menu(); eg buat_sendiri_menu(). I create an associative array where some keynames of the array are assigned with values. The keyname to call function drupal_get_form() is 'page callback' => 'drupal_get_form', and 'page arguments' => array('buat_sendiri_contents'). In short, the way of assigning values to keynames 'page callback'=>'drupal_get_form' & 'page arguments' => array('buat_sendiri_contents') is equivalent to triggering function drupal_get_form('buat_sendiri_contents').

    Like typical hook functions, i must return the value *form* at the end of line when using drupal_get_form(). Here for more info on drupal_get_form(). How do i return *form* is by using system_settings_form($form).


SO, the question bungling in my mind currently is; how can i produce any contents without a need to go through help, menu or block? Anyway is this a valid question?

No comments:

Post a Comment