You are here

function _opigno_lms_install_enable_blocks in Opigno LMS 7

Helper function to enable default blocks.

1 call to _opigno_lms_install_enable_blocks()
opigno_lms_install in ./opigno_lms.install
Implements hook_install().

File

./opigno_lms.install, line 112
Install, update and uninstall functions for the Opigno LMS installation profile.

Code

function _opigno_lms_install_enable_blocks() {
  $default_theme = variable_get('theme_default', 'platon');
  $blocks = array(
    array(
      'module' => 'system',
      'delta' => 'main',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content',
      'visibility' => 0,
      'pages' => '',
      'cache' => DRUPAL_NO_CACHE,
    ),
    array(
      'module' => 'user',
      'delta' => 'login',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'header_login',
      'visibility' => 0,
      'pages' => '',
      'cache' => DRUPAL_NO_CACHE,
    ),
    array(
      'module' => 'views',
      'delta' => 'views_opigno_polls-block_2',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'sidebar_first',
      'visibility' => 1,
      'pages' => "node/*",
      'cache' => DRUPAL_NO_CACHE,
    ),
    array(
      'module' => 'opigno_lms',
      'delta' => 'version',
      'theme' => $default_theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'footer',
      'visibility' => 0,
      'pages' => '',
      'cache' => DRUPAL_CACHE_GLOBAL,
    ),
  );
  $query = db_insert('block')
    ->fields(array(
    'module',
    'delta',
    'theme',
    'status',
    'weight',
    'region',
    'visibility',
    'pages',
    'cache',
  ));
  foreach ($blocks as $block) {
    $query
      ->values($block);
  }
  $query
    ->execute();
}