1 installer.pages.inc installer_browser_install_queue_callback($method, $op, $project_name)

Menu callback; Allows for adding to and removing from the install queue.

File

core/modules/installer/installer.pages.inc, line 1011
Page callbacks used by the Installer browse pages.

Code

function installer_browser_install_queue_callback($method, $op, $project_name) {
  module_load_include('inc', 'installer', 'installer.browser');
  switch ($op) {
    case 'add':
      $projects = installer_browser_get_listed_projects();

      if (isset($projects[$project_name])) {
        $project = $projects[$project_name];
        installer_browser_install_queue_add($project);
      }
      else {
        backdrop_set_message(t('Error: The project was not found.'), 'error');
      }
      break;
    case 'remove':
      installer_browser_install_queue_remove($project_name);
      break;
    default:
      return MENU_NOT_FOUND;
  }

  if ($method === 'ajax') {
    $commands = array();
    // Refresh the install queue.
    $commands[] = ajax_command_replace('.installer-browser-install-queue', installer_browser_get_install_list());
    // Refresh the add to queue link.
    $commands[] = ajax_command_replace('#add-to-queue-link-' . $project_name, installer_browser_add_remove_queue_link($project_name));
    return array('#type' => 'ajax', '#commands' => $commands);
  }

  // Redirect to the page it came from.
  $redirect = (isset($_GET['destination'])) ? $_GET['destination'] : installer_browser_path();
  if ($method === 'form') {
    return $redirect;
  }

  // For $method === 'link' or 'nojs'.
  backdrop_goto($redirect);
  return NULL;
}