7

I have different content type in my site. For testing purpose, I want to add content to all content type form, but manually its not possible in such short term.

So, is any Drush command available to create node?

3

Just a note to point out a new module called Faker which can be used in conjunction with Devel Generate :

Use the PHP Faker library to generate more meaningful sample content.

Devel Generate is great for creating a lot of sample content in a hurry, but sometimes you want samples that are more meaningful, or closer to the content you expect users to generate. This is where Faker comes in.

Faker is a PHP library that generates fake data for you

Faker (the library) can generate real looking names, addresses, emails, domains and more. Faker (the module) combines the library with quick content creation abilities provided by Devel Generate, to give you the power to easily generate real looking sample content.

1

you can use devel generate module to generate content for testing purpose.Not sure this can be achieved using drush.

  • 1
    This is the complete drush command : 'drush generate-content 10 5 --types=blog_post,page` or run drush help generate-content for details of the command. – nit3ch Apr 2 '13 at 12:40
  • One thing to note is that if your content types have any fields from contributed modules those fields may not be populated, as not all modules provide the necessary hook. – Alfred Armstrong Apr 2 '13 at 13:08
1

There are drush genc command, if you write drush help genc you will see next thing.

Create content.

Arguments:
 number_nodes                              Number of nodes to generate.            
 maximum_comments                          Maximum number of comments to generate. 


Options:
 --feedback                                An integer representing interval for insertion rate logging. Defaults to 500 
 --kill                                    Delete all content before generating new content.                            
 --languages                               A comma-separated list of language codes                                     
 --skip-fields                             A comma delimited list of fields to omit when generating random values       
 --types                                   A comma delimited list of content types to create. Defaults to page,article.

So you can create nodes like drush genc 10 and also you can pass --types option(to create nodes of c.types you want). I guess you will need to install Devel module to use this command.

1
drush genc 5 --types=article

create 5 article type node.

0

Try with drush generate-content.

  • You will need the devel module installed and enabled I believe for this to work – kevin.coyle Apr 2 '13 at 12:38

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.