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

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

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

revision 1.34, Fri Oct 23 22:24:13 2009 UTC revision 1.35, Sun Nov 1 14:05:31 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: text.module,v 1.33 2009/10/15 12:44:34 dries Exp $  // $Id: text.module,v 1.34 2009/10/23 22:24:13 webchick Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 563  function text_element_info() { Line 563  function text_element_info() {
563    
564  /**  /**
565   * 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_field_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'][$field['field_name']]  
  *   holds the field's form values.  
  * @param $field  
  *   The field structure.  
  * @param $instance  
  *   the field instance array  
  * @param $langcode  
  *   The language associated to $items.  
  * @param $items  
  *   array of default values for this field  
  * @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  
566   */   */
567  function text_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta = 0) {  function text_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
568    $element = array(    $element += array(
569      '#type' => $instance['widget']['type'],      '#type' => $instance['widget']['type'],
570      '#default_value' => isset($items[$delta]) ? $items[$delta] : '',      '#default_value' => isset($items[$delta]) ? $items[$delta] : '',
571    );    );
# Line 721  function text_textarea_with_summary_proc Line 690  function text_textarea_with_summary_proc
690      '#weight' => 0,      '#weight' => 0,
691      '#title' => t('Summary'),      '#title' => t('Summary'),
692      '#description' => t('Leave blank to use trimmed value of full text as the summary.'),      '#description' => t('Leave blank to use trimmed value of full text as the summary.'),
     '#required' => $element['#required'],  
693      '#display' => $display,      '#display' => $display,
694      '#attached' => array('js' => array(drupal_get_path('module', 'text') . '/text.js')),      '#attached' => array('js' => array(drupal_get_path('module', 'text') . '/text.js')),
695      '#attributes' => array('class' => array('text-textarea-summary')),      '#attributes' => array('class' => array('text-textarea-summary')),
# Line 738  function text_textarea_with_summary_proc Line 706  function text_textarea_with_summary_proc
706      '#title' => $display ? t('Full text') : $element['#title'],      '#title' => $display ? t('Full text') : $element['#title'],
707      '#description' => $element['#description'],      '#description' => $element['#description'],
708      '#required' => $element['#required'],      '#required' => $element['#required'],
     '#required' => $instance['required'],  
709      '#attributes' => array('class' => array('text-full-textarea')),      '#attributes' => array('class' => array('text-full-textarea')),
710      '#prefix' => '<div class="text-full-wrapper">',      '#prefix' => '<div class="text-full-wrapper">',
711      '#suffix' => '</div>',      '#suffix' => '</div>',

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.2