You are here

function hosting_update_6201 in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.install \hosting_update_6201()
  2. 7.3 hosting.install \hosting_update_6201()

Replace lists with Views.

File

./hosting.install, line 408
Install, update and uninstall for the hosting module.

Code

function hosting_update_6201() {
  $ret = array();

  // Remove menu links that will be replaced by Views
  menu_link_delete(NULL, 'hosting/platforms');
  menu_link_delete(NULL, 'hosting/sites');

  // Enable and install Views and Views Bulk operations.
  drupal_install_modules(array(
    'views',
    'views_bulk_operations',
  ));

  // Flush all Drupal caches.
  drupal_flush_all_caches();

  // Temporarily enable Install Profile API module and load includes.
  module_enable(array(
    'install_profile_api',
  ));
  drupal_load('module', 'install_profile_api');
  install_include(array(
    'block',
  ));

  // Enable blocks.
  $theme = 'eldir';
  install_set_block('views', 'hosting_task_list-block', $theme, 'right', 0);
  install_set_block('views', '-exp-hosting_site_list-page_sites', $theme, 'content_top', 0, 1, 'hosting/sites');
  install_set_block('views', 'hosting_site_list-block_platform', $theme, 'content_bottom', 0, 1, 'hosting/c/platform_*');
  install_set_block('views', 'hosting_site_list-block_profile', $theme, 'content_bottom', 0, 2, "<?php\n\$node = menu_get_object();\nif (!empty(\$node)) {\n  return \$node->package_type == 'profile';\n}\n?>");
  install_set_block('views', 'hosting_site_list-block_client', $theme, 'content_bottom', 0, 2, "<?php\n\$node = menu_get_object();\nif (!empty(\$node)) {\n  return \$node->type == 'client';\n}\n?>");
  module_disable(array(
    'install_profile_api',
  ));
  return $ret;
}