You are here

function agenda_admin_configure_submit in Agenda 7

Same name and namespace in other branches
  1. 6.2 agenda.admin.php \agenda_admin_configure_submit()
  2. 6 agenda.admin.php \agenda_admin_configure_submit()
  3. 7.2 agenda.admin.php \agenda_admin_configure_submit()

Save all the settings into our agenda settings table

File

./agenda.admin.php, line 300
Administration interface for the agenda module

Code

function agenda_admin_configure_submit($form, $form_state) {

  // Check if we're creating a new block, in which case the delta is 0
  $delta = $form['agenda_bid']['#value'];
  if ($delta == 0) {
    $delta = db_query('SELECT COALESCE(MAX(bid)+1,1) AS count FROM {agenda}')
      ->fetchField();
  }

  // Save the settings
  foreach ($form_state['values'] as $key => $value) {
    if (!isset($form[$key]['#agenda_setting'])) {
      continue;
    }
    $setting = substr($key, 7);
    agenda_variable_set($delta, $setting, $value);
  }
  drupal_set_message('Block settings were saved successfully');
  drupal_goto('admin/config/services/agenda');
}