You are here

protected function GroupMembershipUIController::profileTableRow in Group 7

Generates the row for the passed type.

1 call to GroupMembershipUIController::profileTableRow()
GroupMembershipUIController::profileTable in classes/group_membership.ui_controller.inc
Generates the render array for an overview table for member profiles.

File

classes/group_membership.ui_controller.inc, line 260
Defines the Entity API UI class for group memberships.

Class

GroupMembershipUIController
UI class for group memberships.

Code

protected function profileTableRow($name, $profile) {
  $profile_fixed = ($profile['entity status'] & ENTITY_FIXED) == ENTITY_FIXED;
  $profile_default = $name == 'group_membership';

  // Add the type label.
  $row['label'] = $profile['label'];

  // Add the status column.
  $row['status'] = array(
    'data' => array(
      '#theme' => 'entity_status',
      '#status' => $profile['entity status'],
    ),
  );
  if ($this->profile_count > 1) {

    // Add the edit action.
    $row['edit'] = $profile_fixed ? '' : l(t('edit'), $profile['path']);
  }

  // Add the Field UI actions.
  if (module_exists('field_ui')) {
    $row['manage fields'] = l(t('manage fields'), $profile['path'] . '/fields');
    $row['manage display'] = l(t('manage display'), $profile['path'] . '/display');
  }
  if ($this->profile_count > 1) {

    // Add the translation action.
    if (module_exists('i18n_string')) {
      $row['translate'] = $profile_default ? '' : l(t('translate'), $profile['path'] . '/translate');
    }

    // Add the clone action.
    $row['clone'] = $profile_default ? '' : l(t('clone'), $profile['path'] . '/clone');

    // Don't show delete action for fixed or default types.
    if ($profile_fixed || $profile['entity status'] == ENTITY_IN_CODE) {
      $row['delete'] = '';
    }
    else {

      // Show revert action for overridden roles.
      if (entity_has_status('group_type', $profile, ENTITY_OVERRIDDEN)) {
        $what = t('revert');
        $path = $profile['path'] . '/revert';
      }
      else {
        $what = t('delete');
        $path = $profile['path'] . '/delete';
      }
      $row['delete'] = $profile_default ? '' : l($what, $path, array(
        'query' => drupal_get_destination(),
      ));
    }

    // Add the export action.
    $row['export'] = $profile_default ? '' : l(t('export'), $profile['path'] . '/export');
  }
  return $row;
}