Skip to content

dcycle/realistic_dummy_content

Repository files navigation

Realistic dummy content

Generate realistic demo content with Devel's devel_generate module.

Usage

Enable this module and Devel's devel_generate. You will now see portraits used for profile pictures, and stock photos instead of the color blocks generated by devel_generate. All images included in this module are freely licensed (see the README.md files in the directories containing the images).

Extending this module

This project contains two modules:

  • Realistic Dummy Content API (realistic_dummy_content_api), which looks inside every enabled module for a specific directory structure (path/to/module/realistic_dummy_content) and replaces dummy content accordingly.

  • Realistic Dummy Content (realistic_dummy_content), which replaces user pictures and node article images with portraits and stock photography. You can reproduce the realistic_dummy_content/realistic_dummy_content directory structure in your own modules as my_custom_module/realistic_dummy_content for better control of the realistic dummy content you want to generate. If you don't want the example stock images that ship with this module, you can disable Realistic Dummy Content (realistic_dummy_content) and leave Realistic Dummy Content API (realistic_dummy_content_api) enabled along with your own custom module.

Developers can also extend Realistic Dummy Content by implementing hooks defined in ./api/realistic_dummy_content_api.api.php. Specifically, if you want to be able to define realistic dummy content for a custom field type and the standard technique is not working, you can submit an issue to the issue queue, or a pull request for this module.

Creating recipes

Often, sites require a set number of entities to be created in a specific sequence. For example, if your site defines schools which have entity references to school boards, a realistic scenario may be to generate 3 school boards followed by 20 schools. You can define this type of recipe based on the example at ./realistic_dummy_content/recipe.

Once your recipe is written, you can run it (create the content):

drush generate-realistic

See ./realistic_dummy_content/recipe/README.md for more details.

Field meta data

Some fields have special meta data: body fields can have input formats in addition to body text; image fields can have alt text in addition to the image. This can be achieved using a specific naming scheme, and you will find an example in the enclosed data, which looks like:

realistic_dummy_content/fields/node/article/
  - body/
    - ipsum.txt
    - ipsum.txt.format.txt
    - lorem.txt
 - field_image/
    - 1.jpg
    - 2.jpg
    - 2.jpg.alt.txt

In the above example, realistic_dummy_content sees two possible body values, one of which with a specific input format; and two possible images, one of which with a specific alt text. Meta data is never compulsory, and in the case where a meta attribute is needed, a reasonable fallback value is used, for example basic_html will be used if no format is specified for the body.

Issue queue and pull requests

See the issue queue if you have questions, bug reports or feature requests.

Pull requests can be filed against the GitHub repo.

Sponsors

About

Generate realistic dummy content for Drupal

Resources

Stars

Watchers

Forks

Packages

No packages published