You are here

function theme_user_relationship_node_access_form in User Relationships 6

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. 7 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 13
User Relationships Node Access module Allows content posted to be shared with users in one's social network

Code

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

  //allowed actions that will appear on the form

  //#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', NULL, $rows);
}