Sorry, what i actually mean is that variable_get needs a
variable on the second position:
Maybe you intended:
'#default_value' =>
variable_get('time_card_pay_periods', $weekly)
Van: development-bounces@drupal.org
[mailto:development-bounces@drupal.org] Namens Joop Sint Jago
Verzonden: woensdag 13 januari 2010 6:57
Aan: development@drupal.org
Onderwerp: Re: [development] Problem I am unable to locate
'#default_value' => variable_get('time_card_pay_periods', array('weekly')),
'#default_value' => variable_get('time_card_pay_periods', array['weekly']),
Square brackets for your array?
Van: development-bounces@drupal.org
[mailto:development-bounces@drupal.org] Namens Cory Gilliam
Verzonden: woensdag 13 januari 2010 6:07
Aan: development@drupal.org
Onderwerp: [development] Problem I am unable to locate
Starting a new module and cant find the solution for
this problem. I am trying to check the admin settings page for the
module, and I am getting this error:
Invalid argument supplied for foreach() in /home/dangerou/public_html/includes/menu.inc
on line 258.
Here is the code in the .module:
function time_card_menu() {
$items['admin/settings/time_card'] = array(
'title' => 'Time card settings',
'description' => 'Change how time card behave.',
'page callback' => 'drupal_get_form',
'page arguments' => array('time_card_admin_settings'),
'access arguments' => array('administer site
configuration'),
'type' => MENU_NORMAL_ITEM,
'file' => 'time_card.admin.inc',
);
return $items;
}
Here is the code in the .inc:
function time_card_admin_settings() {
$options = array('weekly' => 'Weekly');
$form['time_card_pay_periods'] = array(
'#type' => 'checkboxes',
'#title' => t('Your Pay Period is:'),
'#options' => $options,
'#default_value' =>
variable_get('time_card_pay_periods', array('weekly')),
'#description' => t('This will tell
the system how many weeks of information to collect for hour totals.'),
);
return system_settings_form($form);
}
What is it that I am not seeing.