/[drupal]/contributions/modules/flexinode/field_textfield.inc
ViewVC logotype

Contents of /contributions/modules/flexinode/field_textfield.inc

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


Revision 1.10 - (show annotations) (download) (as text)
Thu Nov 10 09:35:16 2005 UTC (4 years ago) by crunchywelch
Branch: MAIN
CVS Tags: DRUPAL-4-7--0-1, DRUPAL-4-7--0-3, DRUPAL-4-7--0-2, HEAD
Branch point for: DRUPAL-4-7
Changes since 1.9: +15 -6 lines
File MIME type: text/x-php
port to 4.7, re-implemented the admin UI, moved them to tabs and made the field adds dropdown instead of links, removed search cruft since it was not being utilized, and broken, general code cleanup
1 <?php
2 // $Id: field_textfield.inc,v 1.9 2005/04/16 12:54:16 JonBob Exp $
3
4 function flexinode_field_textfield_name($field) {
5 return t('text field');
6 }
7
8 function flexinode_field_textfield_form($field, &$node) {
9 $fieldname = 'flexinode_'. $field->field_id;
10 return array($fieldname => array(
11 '#type' => 'textfield',
12 '#title' => t($field->label),
13 '#default_value' => isset($node->$fieldname) ? $node->$fieldname : $field->default_value,
14 '#description' => t($field->description),
15 '#required' => $field->required,
16 '#weight' => $field->weight,
17 ));
18 }
19
20 function flexinode_field_textfield_db_select($field) {
21 $fieldname = 'flexinode_'. $field->field_id;
22 return $fieldname .'.textual_data AS '. $fieldname;
23 }
24
25 function flexinode_field_textfield_db_sort_column($field) {
26 return 'flexinode_'. $field->field_id .'.textual_data';
27 }
28
29 function flexinode_field_textfield_insert($field, $node) {
30 $fieldname = 'flexinode_'. $field->field_id;
31 db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data) VALUES (%d, %d, '%s')", $node->nid, $field->field_id, $node->$fieldname);
32 }
33
34 function flexinode_field_textfield_format($field, $node, $brief = 0) {
35 $fieldname = 'flexinode_'. $field->field_id;
36 return check_plain($node->$fieldname);
37 }
38
39 function flexinode_field_textfield_config($field) {
40 return array('default_value' => array(
41 '#type' => 'textfield',
42 '#title' => t('Default value'),
43 '#default_value' => $field->default_value,
44 ));
45 }
46
47
48 /**
49 * @addtogroup themeable
50 * @{
51 */
52
53 /**
54 * Format a single-line text field for display in a node.
55 *
56 * @param field_id
57 * Which field is being displayed (useful when overriding this function
58 * if you want to style one particular field differently).
59 * @param label
60 * The label for the field as displayed on the node form.
61 * @param value
62 * The value that the user entered for the field.
63 * @param formatted_value
64 * The value that the user entered for the field as pre-formatted by the module.
65 */
66 function theme_flexinode_textfield($field_id, $label, $value, $formatted_value) {
67 $output = theme('form_element', $label, $formatted_value);
68 $output = '<div class="flexinode-textfield-'. $field_id .'">'. $output .'</div>';
69 return $output;
70 }
71
72 /** @} End of addtogroup themeable */

  ViewVC Help
Powered by ViewVC 1.1.2