You are here

function theme_context_ui_form in Context 5

Same name and namespace in other branches
  1. 6 context_ui/context_ui.admin.inc \theme_context_ui_form()
  2. 6.2 context_ui/context_ui.admin.inc \theme_context_ui_form()

Theme function for context_ui_form()

1 theme call to theme_context_ui_form()
context_ui_form in context_ui/context_ui_admin.inc
Generates the omnibus context definition editing form. Note: submission and validation handlers are in context_ui_admin.inc

File

context_ui/context_ui_admin.inc, line 288

Code

function theme_context_ui_form($form) {
  $output = '';
  foreach (element_children($form) as $element) {
    if (isset($form[$element]['#weight']) && $form[$element]['#weight'] < 0) {
      $output .= drupal_render($form[$element]);
    }
  }

  // Render space / key / value trio in a 3-column table
  $header = array(
    t('Namespace'),
    t('Attribute'),
    t('Value'),
  );
  unset($form['namespace']['#title']);
  unset($form['attribute']['#title']);
  unset($form['value']['#title']);
  $rows = array(
    array(
      drupal_render($form['namespace']),
      drupal_render($form['attribute']),
      drupal_render($form['value']),
    ),
  );
  $output .= theme('table', $header, $rows, array(
    'class' => 'context-ui-3col',
  ));

  // Render setters / getters as a two column split
  $header = array(
    t('Set context'),
    t('Respond to context'),
  );
  $setters = $getters = '';
  foreach (context_ui_types('full') as $type => $item) {
    if ($item['#context_ui'] == 'getter') {
      $getters .= drupal_render($form['items'][$type]);
    }
    else {
      $setters .= drupal_render($form['items'][$type]);
    }
  }
  $rows = array(
    array(
      array(
        'data' => $setters,
        'class' => 'setters left',
      ),
      array(
        'data' => $getters,
        'class' => 'getters right',
      ),
    ),
  );
  $output .= theme('table', $header, $rows, array(
    'class' => 'context-ui-2col',
  ));

  // Block visibility
  $header = array(
    t('Blocks'),
    t('Regions'),
  );
  $rows = array(
    array(
      array(
        'data' => drupal_render($form['block']['selector']),
        'class' => 'left',
      ),
      array(
        'data' => drupal_render($form['block']['regions']),
        'class' => 'right',
      ),
    ),
  );
  $output .= theme('table', $header, $rows, array(
    'id' => 'context-ui-blocks',
    'class' => 'context-ui-2col',
  ));
  $output .= drupal_render($form);
  return $output;
}