/[drupal]/drupal/modules/field/modules/number/number.module
ViewVC logotype

Diff of /drupal/modules/field/modules/number/number.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.23, Fri Oct 23 22:24:13 2009 UTC revision 1.24, Sun Nov 1 14:05:31 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: number.module,v 1.22 2009/10/15 12:44:34 dries Exp $  // $Id: number.module,v 1.23 2009/10/23 22:24:13 webchick Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 313  function number_element_info() { Line 313  function number_element_info() {
313    
314  /**  /**
315   * Implement hook_field_widget().   * Implement hook_field_widget().
  *  
  * Attach a single form element to the form. It will be built out and  
  * validated in the callback(s) listed in hook_element_info(). We build it  
  * out in the callbacks rather than here in hook_widget so it can be  
  * plugged into any module that can provide it with valid  
  * $field information.  
  *  
  * Field module will set the weight, field name and delta values  
  * for each form element.  
  *  
  * If there are multiple values for this field, the Field module will  
  * call this function as many times as needed.  
  *  
  * @param $form  
  *   the entire form array, $form['#node'] holds node information  
  * @param $form_state  
  *   the form_state, $form_state['values'] holds the form values.  
  * @param $field  
  *   The field structure.  
  * @param $instance  
  *   the field instance array  
  * @param $langcode  
  *   The language associated to $items.  
  * @param $delta  
  *   the order of this item in the array of subelements (0, 1, 2, etc)  
  *  
  * @return  
  *   the form item for a single element for this field  
316   */   */
317  function number_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta = 0) {  function number_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
318    $element = array(    $element += array(
319      '#type' => $instance['widget']['type'],      '#type' => $instance['widget']['type'],
320      '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,      '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
321    );    );

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.2