1

Is there a way in which from my .module file I can assign a block in a specific region from Dashboard?

1

It can be done in a simple way by mentioning a region key to the $blocks array in the HOOK_block_info(). Follow the code for reference,

    /**
     * Implements hook_block_info()
     * @return array
     */
    function my_module_block_info() {
      $blocks = array();
      $blocks['leaderboard'] = array(
        'info' => t('Leaderboard'),
        'status' => 1,
        'region' => 'dashboard_main',
        'weight' => 99,
        'cache' => DRUPAL_CACHE_PER_ROLE,
      );

      return $blocks;
    }
0

In .install file you can add following sql (change the appropriate values)

db_query("INSERT INTO {blocks} VALUES ('gjg', '0', 1, 0, 1, 0, 0, 1, 'my*', '')");
0

yes. see hook_block_info for region

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.