You are here

function module_builder_menu in Module Builder 6

Same name and namespace in other branches
  1. 5 module_builder.module \module_builder_menu()
  2. 6.2 module_builder.module \module_builder_menu()
  3. 7.2 module_builder.module \module_builder_menu()
  4. 7 module_builder.module \module_builder_menu()

Implementation of hook_menu().

File

./module_builder.module, line 8

Code

function module_builder_menu() {
  $items = array();
  $items['admin/build/module_builder'] = array(
    'title' => 'Module Builder',
    'page callback' => 'module_builder_home',
    'access arguments' => array(
      'build modules',
    ),
    'file' => 'module_builder.pages.inc',
    'description' => 'Make and customize new modules without writing code',
  );
  $modules = module_builder_get_components();
  $default = array();
  $count = 0;
  foreach ($modules as $builder) {
    $items['admin/build/module_builder/edit/%module_builder/' . $builder['machine']] = array(
      'title' => $builder['title'],
      'page callback' => 'drupal_get_form',
      'access arguments' => array(
        'build modules',
      ),
      'page arguments' => array(
        'module_builder_build',
        4,
        5,
      ),
      'type' => $builder['default'] == TRUE ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
      'file' => 'module_builder.pages.inc',
      'description' => 'Make and customize new modules',
      'weight' => $count,
    );
    $count++;
    if ($builder['default'] == TRUE) {
      $default = $builder;
    }
  }
  $items['admin/build/module_builder/edit/%module_builder'] = array(
    'title' => $default['title'],
    'page callback' => 'drupal_get_form',
    'access arguments' => array(
      'build modules',
    ),
    'page arguments' => array(
      'module_builder_build',
      4,
      $default['machine'],
    ),
    'type' => MENU_CALLBACK,
    'file' => 'module_builder.pages.inc',
  );
  $items['admin/build/module_builder/new'] = array(
    'title' => 'Module Builder',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'module_builder_build_new',
    ),
    'access arguments' => array(
      'build modules',
    ),
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'file' => 'module_builder.pages.inc',
  );
  $items['module_builder/js'] = array(
    'title' => 'Module Builder',
    'page callback' => 'module_builder_js',
    'access arguments' => array(
      'build modules',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'module_builder.api.inc',
  );
  $items['module_builder/export/%module_builder/%'] = array(
    'title' => 'Module Builder',
    'page callback' => 'module_builder_export_callback',
    'page arguments' => array(
      2,
      3,
    ),
    'access arguments' => array(
      'build modules',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'module_builder.api.inc',
  );
  return $items;
}