You are here

function access_grant_add_list in Access Control Kit 7

Menu page callback; the add access grant list page.

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

File

./access_grants.admin.inc, line 355
Access grants administrative UI for the access control kit module.

Code

function access_grant_add_list() {
  $content = array();
  foreach (access_scheme_load_multiple() as $scheme) {
    $content[$scheme->machine_name] = array(
      'title' => $scheme->name,
      'description' => $scheme->description,
      'href' => 'admin/access/add/' . str_replace('_', '-', $scheme->machine_name),
      'localized_options' => array(),
    );
  }
  if (empty($content)) {
    return t('You have not created any access schemes yet. Go to the <a href="@create-scheme">access scheme creation page</a> to add a new access scheme.', array(
      '@create-scheme' => url('admin/structure/access/add'),
    ));
  }

  // Bypass this listing page if only one scheme is available.
  if (count($content) == 1) {
    $item = array_shift($content);
    drupal_goto($item['href']);
  }
  return theme('admin_block_content', array(
    'content' => $content,
  ));
}