Broward-Drupal / broward-drupal

Broward Drupal projects
8 stars 0 forks source link

DRAFT: 4_x Naming conventions in Relativity #54

Open modulist opened 6 years ago

modulist commented 6 years ago

(testing here the ability to edit someone else's issue) A lot of the performance in Relativity is tied into how content types, fields, and views are set up. Ideally, if you're setting up content types in Relativity, you've already mapped them out with their corresponding fields in a separate document.

Content types - 4 characters

Content types are abbreviated to a four character combination that is unique and descriptive. Jay Epstein, the originator of Relativity recommends that you use the first four characters if the title of the content type is a single word:

event becomes even

If the content type is two words, you can use the first letter of the first word and then a combination of characters from the following word. Here's an example:

static page becomes spag

Field names - field_4_x

Drupal forces the name of every field to begin with the string field_. To this, you would add the four-letter machine name for the content type, followed by a unique one- or two-word description of the field itself:

The status field of the session content type becomes field_sess_status.

The time slot field of the event content type becomes field_even_time_slot.

Entity references - field_4_4_ref

Entity references start with the string field_, but also include the four-letter content type names, and have _ref at the end, to let us know it's a reference. here's an example:

A session document would be an entity reference from the session content type (sess) to the document content type (docu), so the resulting field would be named field_sess_docu_ref

Mercergirl commented 6 years ago

Thanks for clearing this up. I was confused by the use of “image” as a field name in an earlier version.