I am working on a site for a client who posts many jobs for chefs.

A lot of the jobs are essentially similar, so writing the job postings is something I am trying to simplify.

I can write a series of statements that will serve up similar job descriptions, with pre-written statements that then use |replace to integrate other field data.

So an example statement:

We cook %jobFoodType% to %jobRatingStars%.

Would render as:

'We cook Pub food to a 3 star rating.'

I can write many of these type of statements which can either be selected from a drop down, but I'd like to go a step further and have the drop down when entering a new entry, to be randomly selected from the list of options.

So what I'm asking for, is there a way Craft can randomly pre-populate a field, with a set of predefined statements.

I've had a look at Randomm plugin, which while useful, doesn't let me pre-populate from a predefined set of statements like sentences.

The alternative is to use Randomm to create a random number I use to pick a statement that is in the template, but for obvious reasons, I'd prefer the statements to be driven from Craft.

Any help / thoughts much appreciated. Thank you.

  • I'm confused... you're putting a heavy emphasis on this being a random process, but it seems like you're trying to generate very specific results. What exactly is "random" about it?
    – Lindsey D
    Commented Sep 14, 2015 at 20:45
  • The random aspect is which of the predefined statements is selected. For example I could have 10 statements and when I create a new job entry, one of these is picked at random and saved in the entry.
    – Pathfinder
    Commented Sep 15, 2015 at 7:18

1 Answer 1


I think I'm following and it sounds like the job for a plugin with a custom field type.

In your example, since you want to use a Dropdown field, then your plugin's field type could extend Craft's default Dropdown field type.

When populating the field type's default values (from your pre-defined statements), you could then randomly select which ones are selected on new entries).

  • Thanks Brad, I'll dig into it, about time I understood more about writing plugins.
    – Pathfinder
    Commented Sep 15, 2015 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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