You are here

function recipe_export_multi in Recipe 6

Same name and namespace in other branches
  1. 7.2 recipe.admin.inc \recipe_export_multi()
  2. 7 recipe.admin.inc \recipe_export_multi()
1 string reference to 'recipe_export_multi'
recipe_menu in ./recipe.module
Implementation of hook_menu().

File

./recipe.admin.inc, line 172
recipe.admin.inc -contains all admin pages, settings, and validate.

Code

function recipe_export_multi($type = NULL) {

  // load supported formats
  $formats = module_invoke_all('recipeio', 'export_multi');
  $o = t('Supported bulk output formats:');
  if ($type === NULL) {
    foreach ($formats as $key => $format) {
      $format_count = 0;
      if ($format) {
        $o .= '<br/>' . l($format['format_name'], "admin/content/recipe/export_multi/{$key}");
        $format_count++;
      }
    }
    if ($format_count == 0) {
      $o .= '<br/><p>' . t('You have no export formats available with the bulk export feature.') . '</p>';
    }
    return $o;
  }

  // normalize typed urls
  $type = drupal_strtolower($type);

  // If callback exists, call it, otherwise error out.
  if (isset($formats[$type]) && function_exists($formats[$type]['callback'])) {
    echo call_user_func($formats[$type]['callback']);
  }
  else {
    drupal_set_message(t('Unknown export format(%the_format).', array(
      '%the_format' => $type,
    )), 'error');
    drupal_not_found();
  }
}