If you want to exactly put content in $page['sidebar_first']
, then you can implement hook_page_build() or hook_page_alter(). The difference between the hooks is that the latter is used when the module needs to alter some elements added by another module with hook_page_build()
as the first hook is executed first.
Examples of hook_page_build()
are the following functions.
function toolbar_page_build(&$page) {
$page['page_top']['toolbar'] = array(
'#pre_render' => array('toolbar_pre_render'),
'#access' => user_access('access toolbar'),
'toolbar_drawer' => array(),
);
}
function dashboard_page_build(&$page) {
global $theme_key;
if (dashboard_is_visible()) {
$block_info = array();
// Create a wrapper for the dashboard itself, then insert each dashboard
// region into it.
$page['content']['dashboard'] = array('#theme_wrappers' => array('dashboard'));
foreach (dashboard_regions() as $region) {
// Do not show dashboard blocks that are disabled.
if ($region == 'dashboard_inactive') {
continue;
}
// …
}
// …
}
}
As alternative, your module could define a block, but in that case, the block will be placed in the region set by the administrator users (or any user with the right permission), which could be place the block in a different region. If there isn't a reason to place the content your module is adding in a specific region, then I would rather opt for implementing blocks.