You are here

function theme_autoupload_custom in AutoUpload 7

Theme the custom field type inputs.

1 theme call to theme_autoupload_custom()
autoupload_admin_form in ./autoupload.admin.inc
Form builder for the autoupload settings page.

File

./autoupload.admin.inc, line 179
Contains the administrative functions of the autoupload module.

Code

function theme_autoupload_custom($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {

    // Build the table row.
    $rows[$key] = array(
      'data' => array(
        array(
          'data' => drupal_render($form[$key]['enabled']),
          'class' => 'autoupload-custom-enabled',
        ),
        array(
          'data' => drupal_render($form[$key]['name']),
          'class' => 'autoupload-custom-name',
        ),
        array(
          'data' => drupal_render($form[$key]['context']) . drupal_render($form[$key]['file_input']) . drupal_render($form[$key]['file_event']) . drupal_render($form[$key]['submit_input']) . drupal_render($form[$key]['submit_event']) . drupal_render($form[$key]['error']) . drupal_render($form[$key]['error_remove']),
          'class' => 'autoupload-custom-configuration',
        ),
        array(
          'data' => drupal_render($form[$key]['delete']),
          'class' => 'autoupload-custom-delete',
        ),
      ),
    );

    // Add attributes from the element to the row, such as ahah class.
    if (array_key_exists('#attributes', $form[$key])) {
      $rows[$key] = array_merge($rows[$key], $form[$key]['#attributes']);
    }
  }
  $header = array(
    array(
      'data' => t('Enabled'),
      'title' => t('Flag whether Auto Upload should be active for this field type.'),
    ),
    array(
      'data' => t('Name'),
      'title' => t('Give the field type a name.'),
    ),
    array(
      'data' => t('Configuration'),
      'title' => t('Enter configuration details for this field type.'),
    ),
    array(
      'data' => t('Delete'),
      'title' => t('Delete the configuration.'),
    ),
  );
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}