You are here

function theme_library_admin_new_action in Library 7

Same name and namespace in other branches
  1. 5.2 library.theme.inc \theme_library_admin_new_action()
  2. 6.2 library.theme.inc \theme_library_admin_new_action()
  3. 6 library.theme.inc \theme_library_admin_new_action()

Theme form to create a new action.

Menu callback: Library Actions.

See also

library_admin_action()

library_admin_action_validate()

library_admin_action_submit()

File

./library.theme.inc, line 17
Theming for the library module

Code

function theme_library_admin_new_action($vars) {
  $header = array(
    t('Name'),
    t('Item Status'),
    t('Edit'),
  );
  $output = '';
  $form = $vars['element'];
  foreach (library_actions() as $aid => $action) {
    switch ($action['status_change']) {
      case LIBRARY_ACTION_TYPE_UNAVAILABLE:
        $status_text = 'Unavailable';
        break;
      case LIBRARY_ACTION_TYPE_AVAILABLE:
        $status_text = 'Available';
        break;
      default:
        $status_text = 'No Change';
    }
    $rows[] = array(
      $action['name'],
      $status_text,
      l(t('edit action'), 'admin/config/workflow/library/actions/edit/' . $aid),
    );
  }
  if (isset($form['submit'])) {
    $rows[] = array(
      drupal_render($form['name']),
      drupal_render($form['status_change']),
      drupal_render_children($form),
    );
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  return $output;
}