You are here

function theme_js_injector_admin_form in JS injector 6.2

Same name and namespace in other branches
  1. 6 js_injector.admin.inc \theme_js_injector_admin_form()
  2. 7 js_injector.admin.inc \theme_js_injector_admin_form()

Theme function for the js Injector admin overview form.

File

./js_injector.admin.inc, line 59
Administration pages for js_injector.

Code

function theme_js_injector_admin_form($form) {
  $headers = array(
    t('Title'),
    t('File path'),
    t('Actions'),
  );
  $rows = array();
  if (!empty($form['rules'])) {
    foreach (element_children($form['rules']) as $crid) {
      $row = array();
      $rule = $form['rules'][$crid]['#rule'];
      $row[] = check_plain($rule['title']);
      $row[] = check_plain(_js_injector_rule_path($rule['crid']));
      $row[] = drupal_render($form['rules'][$crid]);
      $rows[] = $row;
    }
  }
  $link = l(t('Create a new rule'), 'admin/settings/js_injector/add');
  $row = array();
  if (empty($rows)) {
    $row[] = array(
      'data' => t('No js injection rules have been set up yet. !url.', array(
        '!url' => $link,
      )),
      'colspan' => 3,
    );
  }
  else {
    $row[] = array(
      'data' => t('!url.', array(
        '!url' => $link,
      )),
      'colspan' => 3,
    );
  }
  $rows[] = $row;
  $output .= theme('table', $headers, $rows);
  $output .= drupal_render($form);
  return $output;
}