1

I've just started learning Drupal, and the devel module is great and everything but I had a couple of questions about it:

  1. Is it possible to change the output text when generating article or basic page content? For example, instead of using Latin Lorem Ipsum filler text, I'd like to be able to use something that puts out actual English words, like Candy Ipsum.

  2. I noticed that when generating article content, it will also generate a small image to go with it, but the images are not of a uniform size. Is there any way to set it to use a fixed resolution?

  3. This is more of a personal preference, but the user names it generates are a little hard to work around. Back when I worked with Django, I had whipped up a script that put together random user names using common first and last names I had compiled into a text file. Is it possible to do something like that here?

Any suggestions on how I could go about doing these things? Is there perhaps another module(s) I could use to get these functions?

-1

Drupal is Open-Source. Just dive in the source code my friend, and mash it up to your taste.

I would probably copy the devel module and rename it devel2, implement custom modifications in there, but it`s just a matter of preference.

5
  • 1
    Yeah, I'm not really all that comfortable diving into the source code as of yet. I'd rather stick to pre-built modules at this point since I'm still new to the system. – Enrico Tuvera Jr Mar 19 '12 at 7:30
  • Ok. For point number 1, just do a text search in the devel module codebase, and replace the Lipsum text with whatever it is you prefer. Point number 2, do a search for the html that is generated, should be in devel generate module, and fix the html output the way you want. Point number 3, is easy enough to customise let me know when you have gone through 1 and 2! :) Good-luck. – stefgosselin Mar 19 '12 at 7:39
  • FYI in both of these cases, if the module gets updated then all changes will be lost - if you go down this route, then make sure you don't update Devel :-) – Chapabu Mar 19 '12 at 9:24
  • Yup, can't find an off-the-shelf solution, so it looks like I'm gonna have to dive in and hack it. – Enrico Tuvera Jr Mar 23 '12 at 6:57
  • @Chapabu allow me to disagree politely, I advised to copy the module and implement custom mods in the copied module. Disabling the original, and using the hacked version makes it easy to port updates when new versions come out. – stefgosselin Apr 12 '12 at 17:30
1

I believe devel generate uses a pattern like [FIELD_NAME]_devel_generate() when deciding who/what to ask for generated data, and then devel implements those functions itself for the core fields.

Unfortunately I don't really see a way to alter this behaviour as there is no Factory pattern or similar that one could use to instantiate derivative/overridden functionality.

What my team usually does is creating content more to our liking in the install profile. This allows us to gradually build in some basic content that the client will want anyway into the development process, and we use a variable to tag nids that won't be useful one we go live, so that we can easily remove the junk content.

If we stick with using devel, here's what I would do:

  1. Hack the module. The code you are looking for is in devel/devel_generate, and then split up into many files, mostly one for each type of content it creates.
  2. Make the functionality generally useful.
  3. Post a patch in the issue queue saying. "I wanted to use devel like this instead, is there a way to incorporate this into Devel?".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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