Last updated April 5, 2014. Created by LeeHunter on April 18, 2010.
Edited by adellefrank, Kristi Wachter, joachim, ultimike. Log in to edit this page.

  1. Navigate to the Content types page (Administer > Structure > Content types).
  2. In the table, locate the row that contains your content type and click the manage fields link.
  3. Adding a new field

  4. In the Add new field section, enter a label for the field.
  5. In the Field name field, enter the machine name for the field. You can only use numbers, lower-case letters and the underscore character (_).
  6. In the field type list, select one of the following types:
    Text
    short text such as a name (limited to 255 characters)
    Long text
    long, multi-line alphanumeric text such as a biography
    Boolean
    has one of two values (for example: "yes/no" or "true/false" or "small/large")
    List (text)
    select from a list of text options (which can be formatted as either a drop-down list or checkboxes)
    File
    reference to a file (such as a PDF) on the Drupal file system
    Image
    reference to an image file such as GIF, JPG, PNG on the Drupal file system
    Term reference
    reference id to an existing Taxonomy Term (or tag)
    Integer
    a whole number, such as a year (e.g. 2012) or value (e.g. 1, 2, 5, 305); it does not allow decimals.
    Float
    a number that can use decimals, such as 0.0123456789
    Decimal
    a number that allows exact decimal values; often used for price or cost (such as $199.99)
    List (float)
    select from a drop-down list of floats
    List (integer)
    select from a drop-down list of integers
    Long text and summary
    same as long text, but with an additional summary text
  7. Select Field

  8. In the Widget field, select a widget. The options vary depending on the field type.
  9. Select Widget type

  10. Click Save.

Note: Not all field types are provided by Drupal core. Things like References, Dates, Links, and various other types can be found by filtering on "field" in the module list on drupal.org (or "Content Construction Kit" for Drupal 6). Users of the CCK module in Drupal 6 should note that the node reference and user reference fields are not supported in Drupal 7 core; however, there is a separate References module that provides support for these fields in Drupal 7.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

If you can't find the "manage fields" link, be sure to enable the Field UI module.

I want to add an integer field, but the only option is List(integer), which is not what I need.
This present two wigets, list/checboxes, but I just want an input field for numbers.
Any help?

Where can a person find the explanation of the different field types:

Boolean
Decimal
File
Float
Image
Integer
List
List (numeric)
List (text)
Long text
Long text and summary
Term reference
Text

Good question!

I for one have no idea what the difference is between 'decimal' and 'float'.

  • Boolean - Values: yes/no or true/false
  • Decimal - Values: numeric value with specific precision and scale (numbers after the decimal point) such as precision 10 and scale 2 for 9,999,999,999.99. Often used for price or cost ($199.99)
  • File - Value: A reference to a file on the Drupal File System
  • Float - Value: An approximate floating point representation of a real number such as 0.0123456789
  • Image - Value: A reference to an image file such as GIF, JPG, PNG on the Drupal File System
  • Integer - Value: A whole number such as 0, 1, 2, 3, 4, 5
  • List (float) - Select from a list of floats
  • List (integer) - Select from a list of integers
  • List (text) - Select from a list of text
  • Long text - Value: Long multi-line alphanumeric text such as long description or biography
  • Long text and summary - Value: Same as long text with an additional summary text
  • Term reference - Value: Reference id to an existing Taxonomy Term
  • Text - Value: Short text such as name or street address

I have a checkbox field and in Manage Display, I have format options of default or key. What is "key"?

With checkboxes, you can setup a "key|checkbox name". (the | is the "pipe" symbol usually found on the same key as the "\") It might be seen as a pain, but opens up other doors if you know how to use them right. But let's say you have the following checkbox list:

Apple
Orange
Strawberry
Lemon

When you create a field with checkboxes, you have to create a "key|value" for each list item. The cool thing is though, the key can be anything (from what I can tell) so for example, you could use a number sequence for the key:

1|Apple
2|Orange
3|Strawberry
4|Lemon

Using a number sequence is fine for a handful of items, but when you start getting a big list and have to re-order them, it can be a butt. Instead, you could use the value as the key like so:
apple|Apple
orange|Orange
strawberry|Strawberry
lemon|Lemon

So, to answer your question, when it asks if you want to display the "Key" or the "Default", the default would be the actual value itself, and the key is... well, the key. Like I said before, there might be times when you want the key to show up instead of the value. For example you want to apply an image to 3 radio buttons, but you don't want the image to show up on the teaser, only on the full node page itself. You would set the teaser to show the "key" and the full node to show the "default". Here's an example that might help:

In Stock|This is in stock <img src="instock.jpg" />
Out Of Stock|This is out of stock <img src="outofstock.jpg" />
On Order|We are ordering more <img src="onorder.jpg" />

When you view the teaser it will show: In Stock
When you view the full node it will show: This is in stock (and the image)

Hope that helps!

How to add a field collection to a content type programmatically?

Building a site in drupal. :) Check out Whats the IXI

i want to create a list of images , where user can select an image option, how can i achieve this?
and i don't want to show text along with image in final post after publishing, i just need image.. please advise