Re: [development] Problem I am unable to locate
Ah, Cory, sorry about the two mails. All rubbish :-) I was confused myself, better go to bed now. _____ Van: development-bounces@drupal.org [mailto:development-bounces@drupal.org] Namens Joop Sint Jago Verzonden: woensdag 13 januari 2010 9:18 Aan: development@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@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.
Had to read it over a couple of times, but the only thing I could lock on to was that '#type' probably wants to be 'checkbox', rather than 'checkboxes'. 'checkboxes' is not a valid form definition. Best, Will
Sure it is: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html... William Smith wrote:
Had to read it over a couple of times, but the only thing I could lock on to was that '#type' probably wants to be 'checkbox', rather than 'checkboxes'. 'checkboxes' is not a valid form definition.
Best, Will
Actually,, I take that back. Of course it is. Apparently we are all answering while it i late and we are over tired. On Wed, Jan 13, 2010 at 4:15 AM, William Smith <william.darren@gmail.com>wrote:
Had to read it over a couple of times, but the only thing I could lock on to was that '#type' probably wants to be 'checkbox', rather than 'checkboxes'. 'checkboxes' is not a valid form definition.
Best, Will
participants (3)
-
J. Sint Jago -
Olivier Jacquet -
William Smith