You are here

function theme_user_relationship_node_access_form in User Relationships 7

Same name and namespace in other branches
  1. 5.2 plugins/user_relationship_node_access/user_relationship_node_access.module \theme_user_relationship_node_access_form()
  2. 6 user_relationship_node_access/user_relationship_node_access.module \theme_user_relationship_node_access_form()

Theme function for styling out the permissions form.

File

user_relationship_node_access/user_relationship_node_access.module, line 30
Allows content posted to be shared with users in one's social network

Code

function theme_user_relationship_node_access_form($arguments) {
  $form = $arguments['form'];
  $all_actions = array(
    'view' => t('view'),
    'update' => t('update'),
    'delete' => t('delete'),
  );

  // Allowed actions that will appear on the form.
  $actions = array();

  // #388726 IE7 will not like sticky javascript table headers, so construct the
  // header as a regular row.
  $header = array(
    array(
      'data' => t('Relationship Type'),
      'header' => 1,
    ),
  );
  foreach ($all_actions as $key => $value) {
    if (isset($form[$key])) {
      $header[] = array(
        'data' => $value,
        'header' => 1,
      );
      $actions[] = $key;
    }
  }
  $rows = array(
    $header,
  );
  foreach ($form[$actions[0]]['#options'] as $rtid => $r_name) {
    $row = array(
      $r_name,
    );
    foreach ($all_actions as $key => $value) {
      unset($form[$key][$rtid]['#title']);
      $row[] = drupal_render($form[$key][$rtid]);
    }
    $rows[] = $row;
  }
  return theme('table', array(
    'rows' => $rows,
  )) . drupal_render($form['set_default']);
}