Save variable in system setting form

function weibo_autopost_admin_config() {
  $form['global'] = array(
    '#type' => 'fieldset',
    '#title' => t('Global settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
 
  $form['global']['weibo_autopost_enable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Default enable Weibo AutoPost in node form.'),
    '#default_value' => variable_get('weibo_autopost_enable', 1), /* variable name must be sane as the element name, otherwise cannot save automatically.
  );
  return system_settings_form($form);
}
Help Share this Article