You are here

function theme_rules_admin_form_arguments in Rules 6

Themes the rules set arguments adding form

1 theme call to theme_rules_admin_form_arguments()
rules_admin_form_add_rule_set in rules_admin/rules_admin.sets.inc
Form for adding a rule set

File

rules_admin/rules_admin.sets.inc, line 358

Code

function theme_rules_admin_form_arguments($form) {
  drupal_add_js(drupal_get_path('module', 'rules_admin') . '/rules_admin.js', 'module');
  $rows = array();
  $headers = array(
    t('Data type'),
    t('Label'),
    t('Machine readable name'),
  );
  $button = drupal_render($form['rules_more']);
  unset($form['rules_more']);
  foreach (element_children($form) as $key) {

    // No need to print the field title every time.
    unset($form[$key]['label']['#title'], $form[$key]['name']['#title'], $form[$key]['type']['#title']);

    // Build the table row.
    $row = array(
      'data' => array(
        array(
          'data' => drupal_render($form[$key]['type']),
          'class' => 'rules-argument-data-type',
        ),
        array(
          'data' => drupal_render($form[$key]['label']),
          'class' => 'rules-argument-label',
        ),
        array(
          'data' => drupal_render($form[$key]['name']),
          'class' => 'rules-argument-name',
        ),
      ),
    );

    // Add additional attributes to the row, such as a class for this row.
    if (isset($form[$key]['#attributes'])) {
      $row = array_merge($row, $form[$key]['#attributes']);
    }
    $rows[] = $row;
  }
  $output = theme('table', $headers, $rows);
  $output .= drupal_render($form) . $button;
  return $output;
}