6

How would you setup a section's entry type to auto-generate the titles based on the title (or slug) of another entry?

For example, we have a Software section with entries. We also have a Releases section. Each release entry has a related software entry, along with a versionNumber text field.

Ideally each release's title would be of the form :

{software.title} {versionNumber}

Where {software.title} is the title from associated entry.

Title Format input example

We've looked at all sorts of combinations to get that value out, but any usage seems to either be ignored or throw an error on publish.

7

You can access the Software entry’s title exactly the same way you would in your front-end templates: software.first.title. The only difference is the single-brace tags syntax, which you don’t even have to use if you don’t want to. Both of these are identical:

  • {software.first.title}
  • {{ object.software.first.title }}
  • How would you loop through a category field if it has multiple selections in a tree and you want them all to be in a title? No syntax I try works. – Alan Miller Sep 11 '14 at 14:32
  • @AlanMiller Not sure I’m following. Probably worth posting a new question. – Brandon Kelly Sep 11 '14 at 16:45
  • I asked my question here, thanks! Multiple category output in auto generated – Alan Miller Sep 11 '14 at 17:22
0

The "Inherit Title" plugin might work for you but you will have to test it for your needs. It hides the title field and then uses the content of other fields in the entry to automatically generate the title for you.

https://github.com/rkingon/Craft-Plugin--Inherit-Title/

From the read.me:

Say you have a "firstName" and "lastName" field, and you would like the Title to auto populate with "firstName lastName" you could use: "{{firstName}} {{lastName}}" as your settings configuration.

  • The option to use an auto-generated title is now a native option. It sounds like it has all the same options, but specifically the issue is with using Entry type content within the field. – Joel Bradbury Jun 12 '14 at 9:50
  • Hey, thanks for that, I had no idea. Brandon and the crew are on such a rapid development cycle, it is hard to keep up with all the new features (not a bad problem to have) :) – Steve Adams Jun 12 '14 at 10:06

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.