You are here

function opigno_lms_update_7102 in Opigno LMS 7

Switch the hard-coded tile menu to using the Drupal Main Menu. Add correct IDs for the CSS to be applied to this instead.

File

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

Code

function opigno_lms_update_7102(&$sandbox) {
  foreach (array(
    '<front>' => array(
      'id' => 'main-navigation-item-home',
    ),
    'my-courses' => array(
      'id' => 'main-navigation-item-my-courses',
    ),
    'course-catalogue' => array(
      'id' => 'main-navigation-item-training-catalogue',
    ),
    'forum' => array(
      'id' => 'main-navigation-item-forum',
    ),
    'opigno-calendar' => array(
      'id' => 'main-navigation-item-calendar',
    ),
    'messages' => array(
      'id' => 'main-navigation-item-messages',
    ),
    'my-achievements' => array(
      'id' => 'main-navigation-item-my-achievements',
    ),
    'admin/opigno' => array(
      'id' => 'main-navigation-item-administration',
    ),
  ) as $path => $attributes) {
    $mlid = db_select('menu_links', 'ml')
      ->fields('ml', array(
      'mlid',
    ))
      ->condition('link_path', $path)
      ->condition('menu_name', 'main-menu')
      ->execute()
      ->fetchField();
    if (!empty($mlid)) {
      $item = menu_link_load($mlid);
      $item['options']['attributes'] = $attributes;
      menu_link_save($item);
    }
  }
  $default_theme_settings = variable_get('theme_platon_settings', array());
  $default_theme_settings['platon_menu_source'] = 'main-menu';
  variable_set('theme_platon_settings', $default_theme_settings);
}