quick tips

Drupal 7: Setting title module field programmatically

Hello and welcome back to Drupal Tips and Tricks. Today we will be looking at the Title module in combination with Entity Translation and we will be trying to change the value of the title field programmatically.

Title module replaces the title property on an entity with a field that can hold different language values. Unfortunately, this isn't as simple as it sounds, because the core title property is defined and used by the core directly in the node table.

Undefined index: field in field_widget_field()

A few days ago, my colleague was building a custom form in Drupal 7. Everything was going great until he added a file field, at which point all hell broke loose. The data didn't submit and he received these notices:

Notice: Undefined index: field in field_widget_field() (Row 578 of ...)
Notice: Undefined index: instance in field_widget_instance() (Row 603 of ....)

Since the field was using a custom widget, we were first debugging there, until we finally found the real culprit somewhere completely else: passing by reference.