From 607e9626d5af265b18e8319b156bb0fda3445cd4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 3 Feb 2009 17:30:13 +0000 Subject: - Patch #361683by Barry, Yves, Karen, Moshe Weitzman, David Strauss, floriant, chx, David Rothstein: initial field API patch. More work to be done, but ... oh my! --- modules/field/sample_code.php | 103 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 modules/field/sample_code.php (limited to 'modules/field/sample_code.php') diff --git a/modules/field/sample_code.php b/modules/field/sample_code.php new file mode 100644 index 000000000..fbbc2eb76 --- /dev/null +++ b/modules/field/sample_code.php @@ -0,0 +1,103 @@ + 'field_single', + 'type' => 'text', +); +field_create_field($field); + +$instance = array( + 'field_name' => 'field_single', + 'bundle' => 'article', + 'label' => 'Single', + 'widget' => array( + 'type' => 'text_textfield', + ), + 'display' => array( + 'full' => array( + 'label' => 'above', + 'type' => 'text_default', + 'exclude' => 0, + ), + ), +); +field_create_instance($instance); + +$instance['bundle'] = 'user'; +field_create_instance($instance); + + +$field = array( + 'field_name' => 'field_multiple', + 'cardinality' => FIELD_CARDINALITY_UNLIMITED, + 'type' => 'text', +); +field_create_field($field); + +$instance = array( + 'field_name' => 'field_multiple', + 'bundle' => 'article', + 'label' => 'Multiple', + 'widget' => array( + 'type' => 'text_textfield', + ), + 'display' => array( + 'full' => array( + 'label' => 'above', + 'type' => 'text_default', + 'exclude' => 0, + ), + ), +); +field_create_instance($instance); + +$instance['bundle'] = 'user'; +field_create_instance($instance); + + +// Number +$field = array( + 'field_name' => 'field_integer', + 'type' => 'number_integer', +); +field_create_field($field); +$instance = array( + 'field_name' => 'field_integer', + 'bundle' => 'article', + 'label' => 'Integer', + 'widget' => array( + 'type' => 'number', + ), + 'display' => array( + 'full' => array( + 'label' => 'above', + 'type' => 'number_integer', + 'exclude' => 0, + ), + ), +); +field_create_instance($instance); + +$field = array( + 'field_name' => 'field_decimal', + 'type' => 'number_decimal', +); +field_create_field($field); +$instance = array( + 'field_name' => 'field_decimal', + 'bundle' => 'article', + 'label' => 'Decimal', + 'widget' => array( + 'type' => 'number', + ), + 'display' => array( + 'full' => array( + 'label' => 'above', + 'type' => 'number_decimal', + 'exclude' => 0, + ), + ), +); +field_create_instance($instance); + + -- cgit v1.2.3