You are here

function linkchecker_link_edit_form in Link checker 5.2

Same name and namespace in other branches
  1. 6.2 includes/linkchecker.pages.inc \linkchecker_link_edit_form()
  2. 7 linkchecker.pages.inc \linkchecker_link_edit_form()

Menu callback for link setting.

1 string reference to 'linkchecker_link_edit_form'
linkchecker_menu in ./linkchecker.module
Implementation of hook_menu().

File

./linkchecker.module, line 492
This module periodically check links in given node types, blocks, cck fields, etc.

Code

function linkchecker_link_edit_form($lid) {
  $link = linkchecker_link_load($lid);
  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings'),
    '#collapsible' => FALSE,
    '#description' => t('The link <a href="@url">@url</a> has been checked lastly at @last_checked and failed @fail_count times.', array(
      '@url' => $link['url'],
      '@fail_count' => $link['fail_count'],
      '@last_checked' => format_date($link['last_checked']),
    )),
  );
  $form['settings']['lid'] = array(
    '#type' => 'hidden',
    '#value' => $link['lid'],
  );
  $form['settings']['url'] = array(
    '#type' => 'hidden',
    '#value' => $link['url'],
  );
  $form['settings']['method_old'] = array(
    '#type' => 'hidden',
    '#value' => $link['method'],
  );
  $form['settings']['method'] = array(
    '#type' => 'select',
    '#title' => t('Select request method'),
    '#default_value' => $link['method'],
    '#options' => array(
      'HEAD' => t('HEAD'),
      'GET' => t('GET'),
    ),
    '#description' => t('Select the request method used for link checks of this link. If you encounter issues like status code 500 errors with the HEAD request method you should try the GET request method before ignoring a link.'),
  );
  $form['settings']['status'] = array(
    '#default_value' => $link['status'],
    '#type' => 'checkbox',
    '#title' => t('Check link status'),
    '#description' => t("Disable this checkbox if you don't like to get informed any longer about this broken link. Use this setting only as the very last option if there is no other way to solve a failed link check."),
  );
  $form['maintenance'] = array(
    '#type' => 'fieldset',
    '#title' => t('Maintenance'),
    '#collapsible' => FALSE,
  );
  $form['maintenance']['recheck'] = array(
    '#default_value' => 0,
    '#type' => 'checkbox',
    '#title' => t('Re-check link status on next cron run'),
    '#description' => t('Enable this checkbox if you need an immediate re-check of the link and cannot wait until the next scheduled check at @date.', array(
      '@date' => format_date($link['last_checked'] + variable_get('linkchecker_check_links_interval', 2419200)),
    )),
  );
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  return $form;
}