Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am considering automatically assigning the uid to several of my content types automatically. However, one other data type uses a number as its title too (product number actually.) There is a strong potential for a uid to be the same as a product number. Could this potentially cause problems? What are some common problems that can arise from non-unique titles?

share|improve this question
    
Node titles do not have to be unique unless you run into a situation where you are loading something by title, or doing a database call by title. –  chadpeppers Apr 22 at 19:39
add comment

3 Answers 3

Drupal itself does not depend on titles or labels to identify entities, and there is no expectation within the core system that they would be unique. You could in theory have a completely functional site with ten thousand nodes all sharing the same title, tagged with ten thousand terms sharing the same name, linked by ten thousand menu items sharing the same label.

Drupal is full of locally unique, automatically generated IDs: each node has an nid, each term has a tid, each menu has an mlid, and so on (though for identifiers unique across the system, one must use UUID or something similar). Provided your custom code, theme output, Views filters, and so on can be written to reference these machine IDs, I would expect few problems.

It is not always possible to rely on those machine IDs; they are content, and so are subject to editing, deletion, and replacement. You might want a banner to appear on your About Us page, but depending on the season the About Us page may be node/25 or node/29, for example.

Thus it is possible, even unconsciously, to build parts of the site that do depend on labels. Many themes insert a class on the <body> based on title, or on the alias/context (which pathauto will by default set to the title); you may have CSS rules applying to the wrong pages. You may have an editorial policy that all nodes pertaining to a particular product include its product code in the title, and set up Views to filter them. But only takes one typo for a node to go missing, or one forgotten edit to the title of a cloned node to have extras appearing.

share|improve this answer
    
I would just clarify that "unique, automatically generated IDs" are unique w/in their use; they aren't globally unique w/in the system. –  MPD Apr 22 at 20:11
    
@MPD True; modules that need truly unique identifiers must rely on UUID or some such. –  choster Apr 22 at 20:23
add comment

Drupal uses node ID (nid column in node table) as a unique identifier and uniqueness of the title is irrelevant for the system.

AFAIK, the only issues you might face are related to management and administration of such content.
For example on admin/content/node or other administrative views it will not be clear which piece of content should you edit or delete. You can easily overcome this by installing Admin Views and including node ID next to the node title in your custom views to make the difference visible.

In one of the projects I developed, titles were generated automatically for one content type. Some nodes had exactly the same titles, but it never caused any issues.

share|improve this answer
add comment

No major problems, in my opinion. you will want to create a new view for editing content though, because the default content view uses title.

also if you're using auto generated URLs they'll be kind of ugly, unless you change how they're structured.

share|improve this answer
    
To get around the content view is using the view bulk operations with administration views. You can add the field you want to be able to distinguish this –  chadpeppers Apr 22 at 19:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.