You are here

function feeds_oai_pmh_sets_options in Feeds OAI-PMH Fetcher and Parser 6

Same name and namespace in other branches
  1. 7 feeds_oai_pmh.module \feeds_oai_pmh_sets_options()

Return a "drupalized" hierarchic options form element for the sets in a repository.

2 calls to feeds_oai_pmh_sets_options()
FeedsOAIHTTPFetcher::sourceForm in ./FeedsOAIHTTPFetcher.inc
Expose source form.
feeds_oai_pmh_set_ahah in ./feeds_oai_pmh.module
Callback function for AHAH setSpec element in form.

File

./feeds_oai_pmh.module, line 35

Code

function feeds_oai_pmh_sets_options($sets) {
  $options = array(
    '*' => t('[all sets]'),
  );
  if (is_array($sets)) {
    ksort($sets);
    $last_depth = 0;
    foreach ($sets as $set_spec => $set_data) {
      $levels = explode(':', $set_spec);
      $label = str_repeat('--', sizeof($levels) - 1) . $set_data['name'];
      $options[$set_spec] = "[{$set_spec}] {$label}";
    }
  }
  return $options;
}