Skip to main content
Joachim's blog

Main navigation

  • Home
  • About

Breadcrumb

  1. Home

cck

By joachim, Wed, 04/11/2009 - 15:19

Creating A Set Of Fields In One Swell Foop

Situation: you need a heap of imagefields that more or less have the same setup. Let's not go into why.

You could spend half an hour bored witless clicking through the interface.

Or you could create just the one field, export the content type with content copy, and then doctor the code a little before importing it back in. Like this....

<?php
// The usual content type stuff here.
// Set of image fields
$image_fields = array(
'field_image_1' => 'Image 1',
'field_image_2' => 'Image 2',
// etc
);

foreach ($image_fields as $name => $label) {

Tags

  • drupal
  • 6.x
  • cck
  • drupal planet
cck

Frequent tags

  • Drupal Code Builder (9)
  • git (7)
  • module builder (6)
  • 6.x (5)
  • drupal commerce (4)
  • development (3)
  • Entity API (3)
  • Field API (3)
  • patching (3)
  • Composer (3)
  • Drush (3)
  • drupal.org (2)
  • debugging (2)
  • tests (2)
  • multisite (2)
  • issue queue (2)
  • Drupal core (2)
  • core (2)
  • 7.x (2)
  • modules (2)
  • roadmap (2)
  • developer tools (2)
  • Rector (2)
  • wtf (2)
  • contributing code (2)
  • maintaining projects (2)
  • code style (2)
  • contrib module (2)
Powered by Drupal