fbpx fields | ComputerMinds Skip to main content

Working with Drupal fields

Fields in Drupal are used as the building blocks for your content, fields can be added to various entity types to allow you complete control over the data that you store. Drupal offers a wide range of field types both out of the box and through a number of contributed modules so you can be very specific over the types of data each field should use. In addition to this you can also control the type of widget used to collect the data and how this data gets displayed to your users using field formatters. See below for some of our article on Drupal fields....

Read some of our articles about Drupal fields

Creating new field formatters in Drupal 7

3rd Feb 2011

Creating extra field formatters in Drupal 7 is fairly simple, but it can take some poking around in the new Fields code. So here is some sample code to make it easier for you! You can add formats to your own fields -- or existing fields that are defined by other Drupal modules. This is the case for the following example - a formatter for a link field to display the URL as an absolute URL.

First, implement hook_field_formatter_info() to declare your field formatter to the fields API, and implement hook_field_formatter_view() which tells Drupal what to do when viewing the...

Read more

Certified to Rock field

19th Jan 2011

Certified to Rock is a site that allows you to look-up Drupal.org user names, and
see their 'certified to rock' score.

CertifiedToRock.com is a way that community members and employers can get a
sense of someone's involvement with the Drupal project. The site uses a custom
algorithm that gathers publicly available information which is then distilled
down into a score on a scale from one to eleven.

I've been wanting to build an easy way to bring this rating into a Drupal site to add an additional metric to user profiles. Until recently this wouldn't have been a simple undertaking...

Read more

Ensuring a CCK field has unique values

27th Jan 2009

Super quick one this: say you have a CCK field on a particular node whose values you want to ensure are unique across all nodes on your site, you could write yourself a nice little helper module, or some PHP directly into the CCK field validation section of the admin form, but, a helper module already exists!
Unique field is a lovely little module that allows you to say that a particular text, number or date field should have unique values across the site, or indeed in that node.

I used this on a user's profile node for a 'alias'...

Read more