You are here

function radioactivity_debug_add_energy_form in Radioactivity 6

1 string reference to 'radioactivity_debug_add_energy_form'
radioactivity_debug_menu in plugins/radioactivity_debug.module

File

plugins/radioactivity_debug.module, line 74
Debugging support for radioactivity

Code

function radioactivity_debug_add_energy_form() {
  $form = array();
  $radioactivity_info = radioactivity_get_radioactivity_info();
  foreach ($radioactivity_info['targets'] as $oclass => $target_info) {
    $form[$oclass] = array(
      '#type' => 'fieldset',
      '#tree' => TRUE,
      '#title' => t('Actions for @oclass', array(
        '@oclass' => $oclass,
      )),
    );
    $form[$oclass]['id'] = array(
      '#type' => 'textfield',
      '#title' => t('@oclass id', array(
        '@oclass' => $oclass,
      )),
      '#size' => 11,
      '#description' => t('Id of the object to receive actions.'),
    );

    // actions
    $options = array();
    foreach ($radioactivity_info['sources'][$oclass] as $source => $source_info) {
      $options[$source] = $source_info['title_placeholder'];
    }
    $form[$oclass]['actions'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Energy actions'),
      '#description' => t('Id of the object to receive actions.'),
      '#default_value' => array(),
      '#options' => $options,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Execute actions'),
  );
  return $form;
}