code

Change from Drupal 7 media field to file field

Upgraded from Drupal 6 to 7 or have a early Drupal 7 installation and there are a high change that you might still use the legacy Media field. This field used to be the only field that allowed us to use the media widget. It have since been replaced by a standard file/image field, provided by Drupal 7 core. Media also need the third part module, File entity (file_entity - https://www.drupal.org/project/file_entity). This module extends core file entity functionality.

How to programmatically create a field in Drupal 7

Ever had a site not controlled by the features module or felt that using it, add to much administrative overhead? Or you simply want to learn how to use Drupal field API? This is for you.

In this example I will try to keep the amount of code to the very minimum. Putting too much features into a example have a tendency to put some people off with the amount of code it create. The example will not explain how you create new field types, but rather use one existing provided by Drupal core.

How to change the HTML markup in a field with a theme function in Drupal

Ever wanted to change the Drupal 7 markup? Get rid of all those pesky divs? If so, this is article for you. I will give you a simple example how to do this not by changing the site theme (template.php) but by using a theme function.

Yes, you have make a module, and yes, I will show you have to make it. You will also find, attached to this article, the complete code wrapped up in a zip-file. Using theme functions is not that hard so relative new Drupal users and themers should be able to follow, though, a basic PHP knowledge might come in handy.

Subscribe to RSS - code