taxonomy_orphanage.admin.inc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. * Admin callbacks for taxonomy_orphanage.
  5. */
  6. /**
  7. * Returns the system settings form.
  8. */
  9. function taxonomy_orphanage_settings() {
  10. $form = array();
  11. $form['batch'] = array(
  12. '#type' => 'fieldset',
  13. '#title' => t('Manual Roundup'),
  14. '#description' => t('Manually start the process to remove all orphaned term references.'),
  15. );
  16. $form['batch']['roundup'] = array(
  17. '#type' => 'submit',
  18. '#value' => t('Round up'),
  19. '#submit' => array('taxonomy_orphanage_admin_roundup'),
  20. );
  21. $form['taxonomy_orphanage_cron_roundup'] = array(
  22. '#type' => 'checkbox',
  23. '#title' => t('Round up orphan references on cron'),
  24. '#default_value' => variable_get('taxonomy_orphanage_cron_roundup', TRUE),
  25. '#description' => t('Check this to enable orphan roundups on cron runs.'),
  26. );
  27. $form['taxonomy_orphanage_cron_limit'] = array(
  28. '#type' => 'select',
  29. '#title' => t('Cron roundup limit'),
  30. '#default_value' => variable_get('taxonomy_orphanage_cron_limit', 50),
  31. '#description' => t('The number of entities per field per cron run to process. NOTE: setting this to a high value can cause instability if your crons are executed via the web server and not by drush.'),
  32. '#options' => array('-1' => t('All'), 10 => 10, 20 => 20, 50 => 50, 100 => 100, 200 => 200, 500 => 500, 1000 => 1000),
  33. );
  34. return system_settings_form($form);
  35. }
  36. /**
  37. * Admin callback to remove orphaned term references.
  38. */
  39. function taxonomy_orphanage_admin_roundup($form, &$form_state) {
  40. taxonomy_orphanage_roundup();
  41. }