You are here

function bulk_photo_nodes_menu_alter in Bulk File Nodes 7

Implements hook_menu_alter().

Replaces standard node add pages with bulk pages.

File

./bulk_photo_nodes.module, line 54
hooks and helper functions for bulk photo node.

Code

function bulk_photo_nodes_menu_alter(&$items) {
  $bpn_var = variable_get('bulk_photo_node_types');
  if (!empty($bpn_var)) {
    foreach (entity_get_info() as $entity_type => $entity_info) {
      if ($entity_type !== 'node') {
        continue;
      }
      foreach (array_keys($entity_info['bundles']) as $bundle) {
        if (isset($bpn_var[$bundle]) && !empty($bpn_var[$bundle . '_override']) && (!empty($bpn_var[$bundle]) || $bpn_var[$bundle] !== 'none')) {
          $node_add_path = 'node/add/' . strtr($bundle, '_', '-');
          $items[$node_add_path]['page callback'] = 'bulk_photo_nodes_page';
          $items[$node_add_path]['page arguments'] = array(
            $bundle,
          );
          $items[$node_add_path]['access callback'] = 'user_access';
          $items[$node_add_path]['access arguments'] = array(
            'create bulk photo nodes',
          );
        }
      }
    }
  }
}