You are here

module_builder.module in Module Builder 6

File

module_builder.module
View source
<?php

include_once drupal_get_path('module', 'module_builder') . '/module_builder.api.inc';

/**
 * Implementation of hook_menu().
 */
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;
}

/**
 * Implementation of hook_perm().
 */
function module_builder_perm() {
  return array(
    'build modules',
  );
}

/**
 * Implementation of hook_simpletest().
 */
function module_builder_simpletest() {
  return array(
    drupal_get_path('module', 'module_builder') . '/module_builder.test',
  );
}

Functions

Namesort descending Description
module_builder_menu Implementation of hook_menu().
module_builder_perm Implementation of hook_perm().
module_builder_simpletest Implementation of hook_simpletest().