Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize Field Namespaces #48

Open
macburgee1 opened this issue Apr 17, 2019 · 2 comments
Open

Standardize Field Namespaces #48

macburgee1 opened this issue Apr 17, 2019 · 2 comments

Comments

@macburgee1
Copy link
Contributor

macburgee1 commented Apr 17, 2019

We should standardize field name spaces.

Proposal

[optional_custom_designator]_[entity_type_abbreviation]_[bundle_abbreviation]_[name]

Proposed entity type abbreviations (max two characters):

  • b = block
  • c = reserved (see Namespace Reserved for Customizations below)
  • ee = External Entity
  • n = node
  • m = media
  • p = paragraph
  • u = user

Proposed bundle abbreviations (max five characters):

  • Blocks
    • html = HTML Code
    • accrd = Accordion
    • card = Card
    • cdcir = Card + Circle Image
  • Nodes
    • aprog = Academic Program
    • bpage = Builder Page
    • news = News
    • person = Person
  • Media
    • image = Image
    • file = File
    • rvid = Remote Video
  • Paragraph
    • Use the host entity's entity type abbreviation + bundle abbreviation + field abbreviation
    • E.g. For a paragraph attached to the Accordion block as an Item field, the prefix would be "p_b_accrd_item_". The paragraph's title field would be "p_b_accrd_item_title".

Examples:

b_html_body = Body field on the HTML Code bundle of the Block entity type
m_file_size = Size field on the File bundle of the Media entity type
n_person_name = Name field on the Profile bundle of the Node entity type

Field machine name prefix

It's possible to modify the field prefix used for machine names:

Field prefix in Field UI is configurable

I propose we remove the field prefix for fields created via the UI, which will free up six characters.

Namespace Reserved for Customizations

We anticipate customizations being built atop this distribution. I propose we reserve the c namespace to avoid future collisions.

c_n_food_group = Food Group field on the custom Food bundle of the Node entity type

@ericras
Copy link
Member

ericras commented Apr 26, 2019

I think this looks like a good plan. Conceivably there are reusable fields, not tied to a bundle. But I generally don't reuse, just in case one instance needs customization later.

The customization namespace could even be enforced potentially. Also, dropping field_ will pretty much insure no problems with existing stuff being migrated into this setup.

@macburgee1
Copy link
Contributor Author

Let's use s for shared, which would replace the optional custom designator.

s_[optional_alentity_type_abbreviation]_[optional_bundle_abbreviation]_[name]

E.g. s_m_file_size for a shared File Size field for media entities (no bundle is designated in this example)

macburgee1 pushed a commit that referenced this issue Apr 29, 2019
macburgee1 pushed a commit that referenced this issue Apr 29, 2019
@ericras ericras pinned this issue Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants