Showing posts with label module. Show all posts
Showing posts with label module. Show all posts

Tuesday, June 24, 2014

104. What is entity api module ?

The entity api module extends the entity API of Drupal core in order to provide a unified way to deal with entities and their properties. Additionally, it provides an entity CRUD controller, which helps simplifying the creation of new entity types.


Saturday, November 5, 2011

42. What is Content Construction Kit (CCK) in Drupal

The Content Construction Kit allows you to add custom fields to custom content types using a web interface. In Drupal 5.x, custom content types can be created in Drupal core, and the Content Construction Kit allows you to add custom fields to any content type. In Drupal 7 and later, most of the functionality of CCK has been absorbed into Drupal core.

Summary and purpose of CCK?


Drupal comes with core content types like story and blog. For such a content type, go to 'Create content' and submit a new story or blog. That's sufficient for pages of pure text and with or without attachments.

But what if your users want to be able to submit reviews of their favorite aardvark? That would be a new content type, but I want to be able to display other stuff as well as a chunk of text for every node of that type, and I don't want it to be just attached file links.

My options: I could hack the story.module, OR I could see if someone has already created an aardvark.module for the exact type of content I want, OR using CCK I could create a new content type called Aardvark Review.

Using CCK, I can create a content type that has exactly the fields I need, no more or less. My Aardvark Review for instance might have:

text field (comments on the aardvark)
dropdown menu (aardvark color)
audio file (recording of the aardvark's grunting)
image (photo of aardvark)
The CCK admin interface for creating these new content types is nice and easy: just create your new type and then click through, adding the type of fields you want it to have and what their parameters will be (how much text for the review? which colors in the dropdown menu?). There are many add-ons available in the downloads section under CCK that add new kinds of fields to your options (video field, audio field, calculated values and vastly more complicated ones).

From the users' perspective, they'll just click on Create content > Aardvark Review and get a form that asks them to submit their review, the aardvark's color, a recording, and picture.


Module Download Page http://drupal.org/project/cck

Monday, May 17, 2010

38. what a module is in Drupal and what the process of writing one involves?

When developers learn that modifying Drupal's core code is a no-no, they often have a panic moment. "How, then will I bend Drupal to do my will?," they ask. Easy: by writing a module. The first part of writing a module is writing a .info file, where you describe your module to Drupal. Here's an example from the Forum Module:

; $Id: forum.info,v 1.6 2007/06/08 05:50:54 dries Exp $

name = Forum

description = Enables threaded discussions about general topics.

dependencies[] = taxonomy

dependencies[] = comment

package = Core - optional

core = 6.x

This gives Drupalenough information to list the module on the modules administration page, and to tell whether the module is compatible with the version of Drupal being run (in this case, 6.x). Drupal will also make sure the dependent modules are present.

A module may have a .install file containing code that runs when the module is first installed. For example, some database tables may be needed, or some values may need to be initialized in Drupal's persistent variable system.

Finally, the .module file itself contains the code that does whatever it is that your module will do. And that's just about anything. There were 3,430 modules in the repository last time I checked, so it's a good idea to check if the module you're thinking about writing is already written. Drupal Modules is a good place to do that.

New Drupal developers are also often stymied by the question "When does my code run? I put it in a module, but when does the module run?" Answering that question requires understanding of the Inversion of Control design pattern that Drupal uses, often called "hooks" or "callbacks". You name your functions in a certain way, and Drupal will automatically call your code at the appropriate time, depending on how you've named the functions.

source: http://ostatic.com/blog/interview-john-vandyk-author-of-pro-drupal-development