You are here

function _pagenotfound_reports_add_operations in Page Not Found Reports 7

Same name and namespace in other branches
  1. 6.2 pagenotfound_reports.admin.inc \_pagenotfound_reports_add_operations()
  2. 6 pagenotfound_reports.module \_pagenotfound_reports_add_operations()

Add a set of operation links to a single dblog (404) entry.

3 calls to _pagenotfound_reports_add_operations()
pagenotfound_reports_all in ./pagenotfound_reports.module
List of all 404s in the log
pagenotfound_reports_referers in ./pagenotfound_reports.module
List of 404s with referers.
pagenotfound_reports_top_404s in ./pagenotfound_reports.module
List of all 404s sorted by most common

File

./pagenotfound_reports.module, line 86
Page Not Found Reports

Code

function _pagenotfound_reports_add_operations($dblog) {
  $operations = array();
  if (module_exists('redirect') && ($path = $dblog->message)) {
    if ($existing = redirect_load_by_source($path)) {
      $operations[] = l(t('Edit redirect'), 'admin/config/search/redirect/edit/' . $existing->rid, array(
        'query' => drupal_get_destination(),
      ));
      $operations[] = l(t('Delete redirect'), 'admin/config/search/redirect/delete/' . $existing->rid, array(
        'query' => drupal_get_destination(),
      ));
    }
    elseif (!empty($dblog->wid)) {
      $operations[] = l(t('Add redirect'), 'admin/config/search/redirect/add', array(
        'query' => drupal_get_destination() + array(
          'pagenotfound-wid' => $dblog->wid,
        ),
      ));
    }
  }
  return !empty($operations) ? implode(' | ', $operations) : NULL;
}