0

My question: Can I (or rather, should I) create a taxonomy and a custom content type that have the same machine name? I plan to 'link' those two together.

I tried to search around and could not find an answer, I found out that two custom fields cannot have the same name, even if they belong to two different content types for example. So that would lead me to suggest that the answer to my question is probably not (i.e. they would try to use the same table name). But I don't know if that's correct.

Say I create a site for a school, and want to have a custom content type 'staff' that will hold teachers, administrative staff, etc. I will also have a vocabulary that has these different staff categories (teachers, administrative staff etc), which I also thought of giving it the name 'staff'. Is this a bad idea?

PS: I'm using Drupal 8

2 Answers 2

1

Technically you can have same name for taxonomy and content type as the underlying machine name is not the same and there is no confict.

Practically it might not be a good idea as it might confuse the end users but it depends on the problem you are trying to solve.

So based on your description staff category might be a better name for your category.

0

Ah .. I am careless. It must obviously be unique, I didn't pay enough attention, it mentions it under the field for the name of the custom content type. It says:

The human-readable name of this content type. This text will be displayed as part of the list on the Add content page. This name must be unique

So I guess it cannot have the same name (machine_name) as a vocabulary. I just write it here for reference...

1
  • 1
    unique for content types or unique for taxonomies as you can see on my answer there is no confict between content type and vocabulary names
    – GiorgosK
    Commented Dec 13, 2017 at 18:44

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.