View source
<?php
include_once drupal_get_path('module', 'module_builder') . '/module_builder.api.inc';
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;
}
function module_builder_perm() {
return array(
'build modules',
);
}
function module_builder_simpletest() {
return array(
drupal_get_path('module', 'module_builder') . '/module_builder.test',
);
}