function theme_flag_admin_page in Flag 5
Same name and namespace in other branches
- 6.2 includes/flag.admin.inc \theme_flag_admin_page()
- 6 includes/flag.admin.inc \theme_flag_admin_page()
- 7.3 includes/flag.admin.inc \theme_flag_admin_page()
- 7.2 includes/flag.admin.inc \theme_flag_admin_page()
Theme the output for the main flag administration page.
1 theme call to theme_flag_admin_page()
- flag_admin_page in includes/
flag.admin.inc - Flag administration page. Display a list of existing flags.
File
- includes/
flag.admin.inc, line 21 - Contains administrative pages for creating, editing, and deleting flags.
Code
function theme_flag_admin_page($flags, $default_flags) {
$output = '<p>' . t('This page lists all the <em>flags</em> that are currently defined on this system. You may <a href="@add-url">add new flags</a>.', array(
'@add-url' => url('admin/build/flags/add'),
)) . '</p>';
// Build out the list of normal, database flags.
foreach ($flags as $flag) {
$ops = theme('links', array(
'flags_edit' => array(
'title' => t('edit'),
'href' => "admin/build/flags/edit/" . $flag->name,
),
'flags_delete' => array(
'title' => t('delete'),
'href' => "admin/build/flags/delete/" . $flag->name,
),
));
$roles = array_flip(array_intersect(array_flip(user_roles()), $flag->roles));
$rows[] = array(
$flag->name,
$flag->content_type,
empty($flag->roles) ? '<em>' . t('No roles') . '</em>' : implode(', ', $roles),
$flag->types ? implode(', ', $flag->types) : '-',
$flag->global ? t('Yes') : t('No'),
$ops,
);
}
if (!$flags) {
$rows[] = array(
array(
'data' => t('No flags are currently defined.'),
'colspan' => 6,
),
);
}
$header = array(
t('Flag'),
t('Flag type'),
t('Roles'),
t('Node types'),
t('Global?'),
t('Operations'),
);
$output .= theme('table', $header, $rows);
// Build a list of disabled, module-based flags.
$rows = array();
foreach ($default_flags as $name => $flag) {
if (!isset($flags[$name])) {
$ops = theme('links', array(
'flags_enable' => array(
'title' => t('enable'),
'href' => "admin/build/flags/edit/" . $flag->name,
),
));
$roles = array_flip(array_intersect(array_flip(user_roles()), $flag->roles));
$rows[] = array(
$flag->name,
$flag->module,
$flag->content_type,
$ops,
);
}
}
if (!empty($rows)) {
$header = array(
t('Disabled Flags'),
t('Module'),
t('Flag type'),
t('Operations'),
);
$output .= theme('table', $header, $rows);
}
if (!module_exists('views')) {
$output .= '<p>' . t('The <a href="@views-url">Views</a> module is not installed, or not enabled. It is recommended that you install the Views module to be able to easily produce lists of flagged content.', array(
'@views-url' => url('http://drupal.org/project/views'),
)) . '</p>';
}
else {
$output .= '<p>';
$output .= t('Lists of flagged content can be displayed using views. You can configure these in the <a href="@views-url">Views administration section</a>.', array(
'@views-url' => url('admin/build/views'),
));
if (flag_get_flag('bookmarks')) {
$output .= ' ' . t('Flag module automatically provides a few <a href="@views-url">default views for the <em>bookmarks</em> flag</a>. You can use these as templates by cloning these views and then customizing as desired.', array(
'@views-url' => url('admin/build/views'),
));
}
$output .= ' ' . t('The <a href="@flag-handbook-url">Flag module handbook</a> contains extensive <a href="@customize-url">documentation on creating customized views</a> using flags.', array(
'@flag-handbook-url' => 'http://drupal.org/handbook/modules/flag',
'@customize-url' => 'http://drupal.org/node/296954',
));
$output .= '</p>';
}
if (!module_exists('flag_actions')) {
$output .= '<p>' . t('Flagging an item may trigger <em>actions</em>. However, you don\'t have the <em>Flag actions</em> module <a href="@modules-url">enabled</a>, so you won\'t be able to enjoy this feature.', array(
'@actions-url' => url('admin/build/flags/actions'),
'@modules-url' => url('admin/build/modules'),
)) . '</p>';
}
else {
$output .= '<p>' . t('Flagging an item may trigger <a href="@actions-url">actions</a>.', array(
'@actions-url' => url('admin/build/flags/actions'),
)) . '</p>';
}
$output .= '<p>' . t('To learn about the various ways to use flags, please check out the <a href="@handbook-url">Flag module handbook</a>.', array(
'@handbook-url' => 'http://drupal.org/handbook/modules/flag',
)) . '</p>';
return $output;
}