This issue is seemingly already up but its closed and I don't know what the protocol/work flow with this is because I don't speak in 1 and 0s. Every time I make a sub theme manually or with the drush command i get this error:

Notice: Array to string conversion in template_process_field() (line 1089 of /srv/bindings/52b7a16580e248bf9beed7a600bc7dfb/code/modules/field/field.module).

I tried the patches in the similar issue but they didn't work. Everyone is fighting over the semantics of them and its ambiguous as to what to do. I basically give up but instead of making more enemies on twitter I figured I would try to post to the issue queue....

Comments

Soloriens’s picture

Hi! Try to set back JQuery Update module from 1.10 to 1.7!

glebaron’s picture

I was able to figure out something that seems to work around the problem but I don't know anything about drupal internals or php so beware.

It's failing when the function template_process_field() in field.module tries to implode the classes_array. When the foundation theme or your subtheme is active it the 5th element points to an array

array(7) { [0]=> string(5) "field" 
               [1]=> string(15) "field-name-body" 
               [2]=> string(28) "field-type-text-with-summary" 
               [3]=> string(18) "field-label-hidden" 
               [4]=> string(13) "field-wrapper" 
               [5]=> array(1) { [0]=> string(4) "body" } 
               [6]=> string(5) "field" } 

Implode doesn't seem to like nested elements.

The workaround is to delete the body field from both the basic_page and article content types and then recreate it.

After doing that the classes array now shows up like this:

array(5) { [0]=> string(5) "field" 
               [1]=> string(21) "field-name-field-body" 
               [2]=> string(28) "field-type-text-with-summary" 
               [3]=> string(17) "field-label-above" 
               [4]=> string(13) "field-wrapper" } 

and everything seems to work correctly.

Hopefully someone who knows what they are doing will find this useful.

alemadlei’s picture

I figured out the same as the user glebaron,

This seems to be a problem in the template.php file of the foundation theme.

I have this line for the body field

    case 'body':
      $variables['classes_array'][] = array('body');

A couple of lines below, for the image fields I see this

    case 'field_link':
    case 'field_date':
      // Replace classes entirely, instead of adding extra.
      $variables['classes_array'][] = array('text-content');
      break;

    case 'field_image':
      // Replace classes entirely, instead of adding extra.
      $variables['classes_array'][] = array('image');
      break;

So based on the contents (assuming they want to replace the whole array, it should instead be

    case 'body':
      $variables['classes_array'] = array('body');

And

    case 'field_link':
    case 'field_date':
      // Replace classes entirely, instead of adding extra.
      $variables['classes_array'] = array('text-content');
      break;

    case 'field_image':
      // Replace classes entirely, instead of adding extra.
      $variables['classes_array'] = array('image');
      break;

Either that, or they should just let the classes to just be added to the whole array.

In my case, I created a subtheme, so what I did was to create a custom, preprocess


/**
 * Implements template_preprocess_field.
 */
function template_preprocess_field(&$vars) {
  
  // Loops trough each item to check if any of them is array, and if it is, 
  // converts it to a single string, in order to fix problem on base theme implementation.
  foreach ($vars['classes_array'] as &$class) {
    if (is_array($class)) {
      $class = join(' ', $class);
    }
  }
  
}

This works for my particular needs. The eror message stopped showing afterwards.

Hopefully this helps someone else too.

crantok’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #2205041: template_process_field() . See that issue for a patch that fixes the problem. Although the patch is committed to the dev version, I don't recommend upgrading to the dev version because that gave me far more PHP errors.