You are here

function crumbs_admin_form_submit in Crumbs, the Breadcrumbs suite 7

Same name and namespace in other branches
  1. 6.2 crumbs.admin.inc \crumbs_admin_form_submit()
  2. 6 crumbs.admin.inc \crumbs_admin_form_submit()

File

admin/crumbs.admin.inc, line 194

Code

function crumbs_admin_form_submit($form, &$form_state) {
  $weights = crumbs_get_weights();
  asort($weights);
  list($plugins, $disabled_keys) = crumbs_get_plugins();
  list($available_keys, $keys_by_plugin) = _crumbs_load_available_keys($plugins);
  $weights = array();
  $text = $form_state['values']['settings'];
  $lines = explode("\n", $text);
  $weight = 0;
  foreach ($lines as $line) {
    $line = trim($line);
    list($key, $title) = explode(' ', $line, 2) + array(
      NULL,
      NULL,
    );
    if (isset($available_keys[$key])) {
      $weights[$key] = $weight;
      ++$weight;
    }
    elseif (preg_match('/^-/', $line)) {
      if ($weight !== FALSE) {
        $weight = FALSE;
      }
      else {
        break;
      }
    }
  }
  variable_set('crumbs_weights', $weights);
  variable_set('crumbs_show_current_page', $form_state['values']['show_current_page']);
}