Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am looking at turning my Features into proper modules. There is nothing fancy to them other than a content type, a couple of textfields attached and a view. It looks like the features module pretty much exports these into a module anyways but it looks like it relies on some helper functions in the features module to get this going. How can I convert my feature so that it doe not require the features module to be installed?

share|improve this question
    
It's an interesting question, so you get an upvote. However I'm curious as to why you would want to do this? Features provides the ability to update your..well..features really easily. You'd lose this ability when converting to standalone module. –  Chapabu Jun 22 '12 at 8:12
1  
I am mainly a designer looking to better understand coding and dev of modules. I feel this would be a good opportunity to learn how a basic module, with some couple of fields and a view would be structured. I learn better by deconstructing something, rather than building from scratch. I have taken a look around D.O for a module that is basic enough for me to dissect, but many have admin options and other settings. I have also taken a look at the Examples module, but it doesn't have have examples of adding views. –  Cynthia Jun 22 '12 at 13:30
    
Typically, though, hand-coded modules don't add views or content types. It's much easier to use Features to build them. If you want to spend time productively, you would be better off learning the most commonly-used hooks such as hook_menu, hook_permission and the form api. –  Alfred Armstrong May 9 '13 at 15:09
add comment

2 Answers

I don't know of an example module that has all of those pieces together, but I think you'll find that field_example and node_example from the Examples for Developers project useful.

As well, this page of the Features documentation mentions something interesting:

Technically, an exported Feature is a Drupal module – it has a .info file and a .module file (along with some .inc files matching the components of the feature).

If you're a developer and find a feature bundle a good starting point for a module, you could just extend the feature by editing its .module file (and if need be also the .info file) to include hooks and what have you.

So you may wish to export your Feature, then develop on it from there based on the samples in field_example and node_example.

share|improve this answer
add comment

In my experience, you just want to create a content type by a custom module.

If this is your goal, all you need is to create a .install file.

When you install your module all the content type and field will be set up completely.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.