You are here

function theme_empty_page_callbacks_manage_render in Empty Page 7

Theme function to render the callback management admin interface.

Return value

string $output (rendered html)

1 theme call to theme_empty_page_callbacks_manage_render()
empty_page_admin_overview in ./empty_page.admin.inc
Container for the callback management interface.

File

./empty_page.admin.inc, line 26
Administrative functionality for Empty Page module.

Code

function theme_empty_page_callbacks_manage_render() {
  $callbacks = empty_page_get_callbacks();
  $edit_access = user_access(EMPTY_PAGE_PERM_ADMIN_CALLBACKS);
  $rows = array();
  foreach ($callbacks as $cid => $callback) {
    $rows[$cid][] = '<strong>' . $callback->path . '</strong>';
    $rows[$cid][] = l(t('View'), $callback->path);
    if ($edit_access) {
      $rows[$cid][] = l(t('Edit'), 'admin/structure/empty-page/' . $callback->cid . '/edit');
      $rows[$cid][] = l(t('Delete'), 'admin/structure/empty-page/' . $callback->cid . '/delete');
    }
  }
  $header = array();
  if ($edit_access) {
    $header = array(
      t('Internal Path'),
      t('View'),
      t('Edit'),
      t('Delete'),
    );
  }
  $admin_add = t('<a href="@url">Add one now!</a>', array(
    '@url' => url('admin/structure/empty-page/add'),
  ));
  if (count($callbacks)) {
    $output = theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  else {
    $output = '<p style="padding:10px 0;margin:0;">' . t('No callbacks exist yet.') . ($edit_access ? ' ' . $admin_add : '') . '</p>';
  }
  return $output;
}