You are here

function emimport_menu in Embedded Media Field 5

Implement hook_menu

File

contrib/emimport/emimport.module, line 11

Code

function emimport_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/content/emfield/import',
      'title' => t('Import settings'),
      'description' => t('Configure Embedded Media Import: Allow importing 3rd party provider playlists; set content types and taxonomy; etc.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'emimport_settings',
      'access' => user_access('administer site configuration'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 3,
    );
    $items[] = array(
      'path' => 'emimport',
      'title' => t('Import media set'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'emimport_import',
      'type' => MENU_ITEM_GROUPING,
      'access' => user_access('import media sets'),
      'weight' => 1,
    );
    foreach (emimport_types_allowing_import(FALSE, FALSE) as $module => $types) {
      foreach ($types as $type => $fields) {
        $type = node_get_types('type', $type);
        $type_url_str = str_replace('_', '-', $type->type);
        $items[] = array(
          'path' => 'emimport/' . $type_url_str,
          'title' => t('Import @type set', array(
            '@type' => $type->name,
          )),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'emimport_import',
            $type->type,
          ),
          'access' => user_access('import media sets') && user_access('create ' . $type->type . ' content'),
        );
      }
    }
  }
  return $items;
}