You are here

function access_overview_schemes in Access Control Kit 7

Menu page callback; the access schemes overview page.

1 string reference to 'access_overview_schemes'
access_menu in ./access.module
Implements hook_menu().

File

./access_schemes.admin.inc, line 11
Access schemes administrative UI for the access control kit module.

Code

function access_overview_schemes() {
  $field_ui = module_exists('field_ui');
  $header = array(
    t('Name'),
    array(
      'data' => t('Operations'),
      'colspan' => $field_ui ? '4' : '2',
    ),
  );
  $rows = array();
  foreach (access_scheme_load_multiple() as $scheme) {
    $url = 'admin/structure/access/' . str_replace('_', '-', $scheme->machine_name);
    $row = array(
      theme('access_overview_scheme_name', array(
        'scheme' => $scheme,
      )),
    );

    // The edit operation.
    $row[] = array(
      'data' => l(t('edit'), $url),
    );

    // Field UI operations.
    if ($field_ui) {

      // Manage fields.
      $row[] = array(
        'data' => l(t('manage fields'), $url . '/fields'),
      );

      // Manage display.
      $row[] = array(
        'data' => l(t('manage display'), $url . '/display'),
      );
    }

    // The delete operation.
    $row[] = array(
      'data' => l(t('delete'), $url . '/delete'),
    );
    $rows[] = $row;
  }
  $build['scheme_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No access schemes available. <a href="@link">Add an access scheme</a>.', array(
      '@link' => url('admin/structure/access/add'),
    )),
  );
  return $build;
}