You are here

function module_builder_get_components in Module Builder 6

Gets all components

Components are things like 'node', 'menu', 'comment'. Basically, a component is a hook (however, like the node component, it is not limnited to one Components are supplied with hook_module_builder. It returns an array of arrays, which give information about the components. The components each have a title, a machine(-readable name) a callback (which returns an FAPI array), and a submit function (which is set to a reasonable default).

Return value

An array of all the components

See also

module_builder_module_builder for the example components array

module_builder_edit_form for an example form

3 calls to module_builder_get_components()
module_builder_build in ./module_builder.api.inc
Builder form
module_builder_menu in ./module_builder.module
Implementation of hook_menu().
_module_builder_export_module in ./module_builder.api.inc

File

./module_builder.api.inc, line 24
API functions for the module_builder module

Code

function module_builder_get_components() {
  include_once drupal_get_path('module', 'module_builder') . '/module_builder.components.inc';
  $return = array();
  foreach (module_implements('module_builder') as $module) {
    $function = $module . '_module_builder';
    $result = $function();
    foreach ($result as $item) {
      $return[$item['machine']] = $item + array(
        'title' => '',
        'machine' => '',
        'callback' => '',
        'default' => FALSE,
        'submit' => 'module_builder_default_submit',
        'submit_button' => TRUE,
        'export' => FALSE,
      );
    }
  }
  return $return;
}