X-Ray of What Produces a Block

  • In the Introduction to Module Development chapter we outlined, and then automated, how to look up what function produces the main content of a given page.

    1. Identify a page that produces output like we'd want to see.
    2. Look up the page callback function for that page's menu item.
    3. See what functions are used (or database queries made) in the page callback function.

    A tip then promised an analogous process to see how a Drupal module produces a given block. This page is to make good on that promise.

    1. Identify a block you are interested in.
    2. While logged in as a user with full permissions, hover over a block and click it's edit linke
    3. If you want to know more about what is producing the block, search the code for the part after "admin/structure/block/manage/". The first part will be the module name that is providing the block. Hence, the User menu and Navigation menu blocks are both provided by "system". The part after the slash will be the identifier for the block.

    You can take the module name and add "_block_info" to get the name of the function defining the block, for instance system_block_info().