[development] Problem I am unable to locate

J. Sint Jago j.sintjago at xs4all.nl
Wed Jan 13 08:28:05 UTC 2010


Ah, Cory, sorry about the two mails. All rubbish :-)

I was confused myself, better go to bed now.

 

 

 

  _____  

Van: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
Namens Joop Sint Jago
Verzonden: woensdag 13 januari 2010 9:18
Aan: development at drupal.org
Onderwerp: Re: [development] Problem I am unable to locate

 

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 at drupal.org [mailto:development-bounces at drupal.org]
Namens Joop Sint Jago
Verzonden: woensdag 13 januari 2010 6:57
Aan: development at 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 at drupal.org [mailto:development-bounces at drupal.org]
Namens Cory Gilliam
Verzonden: woensdag 13 januari 2010 6:07
Aan: development at 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100113/434515d5/attachment-0001.html 


More information about the development mailing list