复选框我有一个非常令人困惑的问题

时间:2015-05-08 08:46:37

标签: forms drupal module drupal-7 watchdog

我的复选框返回给我的值有问题: 首先,我从这2个变量开始:

 $blabla_severity_levels =
   variable_get('blabla_severity_levels', array());

 $blabla_severity_options = array();

然后我为看门狗制作了一个:

   foreach (watchdog_severity_levels() as $severity_numbers => $severity) {
       $blabla_severity_options[$severity_numbers] = check_plain(drupal_ucfirst($severity));
   }

然后我生成表格:

$blabla_form['blabla_severity_levels'] = array(
      '#type'          => 'checkboxes',
      '#title'         => t('Type of log messages'),
      '#options'       => $blabla_severity_options,
      '#default_value' => array_values($blabla_severity_levels),
      '#required'      => TRUE,
    );
return system_settings_form($blabla_form);

在我的功能中,我称之为:

$severity_levels = variable_get('blabla_severity_levels', array());

现在如果我做dpm($severity_levels) 它让我出了一个

的数组
error (String, 5 characters ) error
warning (String, 7 characters ) warning
emergency (Integer) 0
alert (Integer) 0
critical (Integer) 0
notice (Integer) 0
info (Integer) 0
debug (Integer) 0

但我真的需要的是blabla_severity_options:

error (String, 5 characters ) 3
warning (String, 7 characters ) 4
emergency (Integer) 0
alert (Integer) 0
critical (Integer) 0
notice (Integer) 0
info (Integer) 0
debug (Integer) 0

我想保存价值......任何想法PLZ?我真的需要帮助

0 个答案:

没有答案