You are here

function rdfui_menu in RDF Extensions 7.2

Implements hook_menu().

File

rdfui/rdfui.module, line 50

Code

function rdfui_menu() {
  $items = array();

  // Create tabs for all possible bundles.
  foreach (entity_get_info() as $entity_type => $info) {
    if ($info['fieldable']) {
      foreach ($info['bundles'] as $bundle_name => $bundle_info) {
        if (isset($bundle_info['admin'])) {

          // Extract informations from the bundle description.
          $path = $bundle_info['admin']['path'];
          $bundle_arg = isset($bundle_info['admin']['bundle argument']) ? $bundle_info['admin']['bundle argument'] : $bundle_name;
          $access = array_intersect_key($bundle_info['admin'], drupal_map_assoc(array(
            'access callback',
            'access arguments',
          )));
          $instance_position = count(explode('/', $path)) + 1;
          if ($entity_type == 'node') {
            $title = t('RDF Mappings');
            $weight = 2;
          }
          elseif ($entity_type == 'comment') {
            continue;
            $title = t('Comment RDF Mappings');
            $weight = 60;
          }
          else {
            $title = t('RDF Mappings');
            $weight = 50;
          }
          $items["{$path}/rdf"] = array(
            'title' => $title,
            // @todo Load arguments are not necessary / are cruft, right?

            //'load arguments' => array($obj_type, $bundle_arg),
            'page callback' => 'drupal_get_form',
            'page arguments' => array(
              'rdfui_admin_rdf_overview_form',
              $entity_type,
              $bundle_arg,
              $instance_position,
            ),
            'type' => MENU_LOCAL_TASK,
            'weight' => $weight,
          ) + $access;
        }
      }
    }
  }
  $items['rdfui/classes/autocomplete'] = array(
    'title' => t('RDF classes autocomplete'),
    'page callback' => 'rdfui_classes_autocomplete',
    'access arguments' => array(
      'administer RDF field mappings',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['rdfui/datatype/autocomplete'] = array(
    'title' => t('RDF datatype autocomplete'),
    'page callback' => 'rdfui_datatype_autocomplete',
    'access arguments' => array(
      'administer RDF field mappings',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['rdfui/predicates/autocomplete'] = array(
    'title' => t('RDF predicates autocomplete'),
    'page callback' => 'rdfui_predicates_autocomplete',
    'access arguments' => array(
      'administer RDF field mappings',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}