[support] Scope of user-defined content type field identifiers

Andy Heath andyheathoss at axelrod.plus.com
Mon Jul 25 20:49:35 UTC 2011


>> Drupal 7.4
>>
>> Seems a bit wierd to me - field identifiers/labels on out-of-the-box
>> content types behave as local to the content type - i.e. one can have
>> the same identifier on fields in different content types (such as Title
>> and Body example). And when I create a new content type I get these
>> local names for free.  Yet when I try to re-use names in different
>> content types Mr. "don't do naughty things" says "you can't do that
>> because the name is already in use" - i.e. user-defined field names
>> behave as if they are global.
>>
>> Is there some reason for this and any way around it ? Its quite limiting
>> having to artificially choose different names for the same thing in
>> different records (for example if I'm using a Tag field with its own
>> vocabulary in more than one record - if I want to define a content type
>> that has a Tag field I can't unless I call it something else because the
>> name is in use).
>>
>> I'm a bit of a drupal newbie but learning fast.
>>
>> andy
> It is because you can have the same field on many coontent types. As
> example, i create a field with the name "image" and add it to a content
> type. If i want a field with same name and same options on another
> content type, i can just use that "image" field i created before, i do
> not need to create a new field.

Ermmm - no, that; exactly what I would have expected and what it won't 
do for me.  For example, Article has a field

Label: Tags
Name: Field_tags

Its value has several type attributes that constrain what in some 
programming language or other I might call its "type" - I can re-use 
these without problem.  But suppose I want to create another 
content-type of my own with a field having the same Label and Name - the 
system won't do it - I have to call them say Tags1 and Field_tags1.

Now Label and Name are not different kinds of things from the other 
fields so why should they be immutable ? Also - they *are* re-used, but 
only in content that comes out-of-the box not user-defined content.

This seems to be a limitation (but it may be me doing something wrong). 
If it *is* a limitation in practice then my question is - is it a 
necessary limitation of the model/paradigm and if so why ?

andy



More information about the support mailing list