You are here

function crumbs_admin_form_submit in Crumbs, the Breadcrumbs suite 6.2

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

File

./crumbs.admin.inc, line 147

Code

function crumbs_admin_form_submit($form, &$form_state) {
  module_load_include('inc', 'crumbs', 'crumbs.plugin_engine');
  $weights = _crumbs_load_weights();
  asort($weights);
  $plugins = _crumbs_load_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);
    if (isset($available_keys[$key])) {
      $weights[$key] = $weight;
      ++$weight;
    }
    else {
      if (preg_match('/^-/', $line)) {
        if ($weight !== FALSE) {
          $weight = FALSE;
        }
        else {
          break;
        }
      }
    }
  }
  variable_set('crumbs_weights', $weights);
}