Answers.Body: <p>It's important to understand the difference between errors and notices. The message you're seeing says "<em>Notice</em> Array to string conversion" so it is not an error. Notices are just info to programmers pointing out something they could do better and are generally harmless. Your Drupal site should be configured to <em>not</em> display notices to your users (you can just hide them in the admin settings).</p>
  
  <p>As for what exactly is causing it... I squinted at the line of code you pasted in but don't see anything wrong with it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-12T01:21:52.580Z
Answers.LastActivityDate: 2015-12-12T01:21:52.580Z
Answers.UserDisplayName: Coleman
Body: <p>Help, please! I'm getting the following error code:</p>
  
  <p>Notice: Array to string conversion in wf_crm_admin_component::preprocessComponentsForm() (line 555 of /home/makom/www/www/sites/all/modules/webform_civicrm/includes/wf_crm_admin_component.inc).</p>
  
  <p>Here is the code in question, line 555 is the last line of text, which starts "$type = array." I'm not by any means a PHP expert, can anyone help me parse this issue, and if not fix it, at least understand what it means? </p>
  
  <pre><code>  // Component row
    elseif (!empty($row['data-cid']) &amp;&amp; isset($node-&gt;webform['components'][$row['data-cid']])) {
      $cid = $row['data-cid'];
      $component = $node-&gt;webform['components'][$cid];
      $type = &amp;$row['data'][1];
      if ($component['type'] == 'civicrm_contact') {
        $types = array(
          'autocomplete' =&gt; t('Contact - Autocomplete'),
          'select' =&gt; t('Contact - Select List'),
          'hidden' =&gt; $component['extra']['show_hidden_contact'] ? t('Contact - Static') : t('Contact - Hidden'),
        );
        $type = $types[$component['extra']['widget']];
      }
      elseif ($component['type'] == 'select') {
        if ($component['extra']['aslist']) {
          $type = $component['extra']['multiple'] ? t('Multi-select') : t('Select');
        }
        else {
          $type = $component['extra']['multiple'] ? t('Checkboxes') : t('Radio buttons');
        }
      }
      if (in_array($cid, $enabled)) {
        $fields = wf_crm_get_fields();
        $sets = wf_crm_get_fields('sets');
        $class = 'civi-icon';
        list( , $c, $ent, $n, $table, $name) = explode('_', $component['form_key'], 6);
        $field = wf_crm_aval($fields, $table . '_' . $name, array('type' =&gt; 'fieldset'));
        // Don't allow CiviCRM fields to be cloned
        $row['data'][6] = '';
        if ($component['type'] == 'fieldset') {
          $title = t('Contact !num', array('!num' =&gt; $c));
          $type = t('Fieldset for !contact', array('!contact' =&gt; wf_crm_contact_label($c, $data)));
          $row['data'][6] = l(t('Clone Contact'), "node/{$node-&gt;nid}/webform/components/$cid/clone", array(
            'attributes' =&gt; array('title' =&gt; t('Add a new contact to the form with the same fields and settings')
            )));
          $class .= ' fieldset';
        }
        elseif ($ent == 'contact') {
          $field_type = ($table == 'contact' || $table == 'other') ? $field['name'] : $sets[$table]['label'];
          $title = t('!type Field for !contact', array('!contact' =&gt; wf_crm_contact_label($c, $data), '!type' =&gt; $field_type));
        }
        else {
          $title = t('Field for !type', array('!type' =&gt; $sets[$table]['label']));
        }
        if ($table === 'address' &amp;&amp; $component['type'] === 'textfield') {
          if ($name === 'state_province_id' || $name === 'county_id') {
            $type = t('AJAX Select');
          }
        }
        if ($component['type'] == 'civicrm_contact' || $component['type'] == 'fieldset') {
          $class .= ' ' . $node-&gt;webform_civicrm['data']['contact'][$c]['contact'][1]['contact_type'];
        }
        if ($component['type'] == 'select') {
          $type .= ' (' . (empty($component['extra']['civicrm_live_options']) ? t('static') : t('live')) . ')';
        }
        // Show defaults with labels instead of keys
        if ($component['type'] == 'civicrm_contact') {
          if ($component['extra']['default'] == 'contact_id') {
            $row['data'][2] = check_plain(wf_crm_display_name($component['extra']['default_contact_id']));
          }
          elseif ($component['extra']['default'] == 'user') {
            $row['data'][2] = t('Current User');
          }
          elseif ($component['extra']['default'] == 'auto') {
            $row['data'][2] = t('Auto - From Filters');
          }
          elseif ($component['extra']['default'] == 'relationship' &amp;&amp; $component['extra']['default_relationship']) {
            $row['data'][2] = t('Relationship to !contact', array('!contact' =&gt; wf_crm_contact_label(1, $data)));
          }
        }
        elseif (isset($component['value']) &amp;&amp; strlen($component['value']) &amp;&amp; ($field['type'] == 'select' || !empty($field['expose_list']))) {
          if ($component['type'] == 'select') {
            $items = wf_crm_str2array($component['extra']['items']);
          }
          else {
            $items = wf_crm_field_options($component, 'components_form', $node-&gt;webform_civicrm['data']);
          }
          $val = '';
          foreach (explode(',', $component['value']) as $v) {
            if (isset($items[trim($v)])) {
              $val .= ($val ? ', ' : '') . $items[trim($v)];
            }
          }
          $row['data'][2] = $val;
        }
        // Contribution page - link to civicrm config form instead of component edit form
        if ($name == 'contribution_page_id') {
          $type = t('CiviCRM Billing Fields');
          $class .= ' contribution';
          $row['data'][5] = l(t('Configure'), 'civicrm/admin/contribute/settings', array(
            'query' =&gt; array(
              'reset' =&gt; 1,
              'action' =&gt; 'update',
              'id' =&gt; $component['value'],
            ),
            'attributes' =&gt; array(
              'title' =&gt; t('Edit Contribution Page in CiviCRM'),
            )
          ));
        }
        $type = array('data' =&gt; '&lt;span class="' . $class . '"&gt; &lt;/span&gt;' . $type, 'title' =&gt; $title);
      }
    }
  }
  </code></pre>
  
  <p>}</p>
  
Tags: <webform-civicrm><php>
Title: Array String Error Code in Webform Integration
ThreadText: # Array String Error Code in Webform Integration
  
  (Asked by: username_0 on 2015-12-10)
  
  Help, please! I'm getting the following error code:
  Notice: Array to string conversion in wf_crm_admin_component::preprocessComponentsForm() (line 555 of /home/makom/www/www/sites/all/modules/webform_civicrm/includes/wf_crm_admin_component.inc).
  Here is the code in question, line 555 is the last line of text, which starts "$type = array." I'm not by any means a PHP expert, can anyone help me parse this issue, and if not fix it, at least understand what it means? 
    // Component row
    elseif (!empty($row['data-cid']) && isset($node->webform['components'][$row['data-cid']])) {
      $cid = $row['data-cid'];
      $component = $node->webform['components'][$cid];
      $type = &$row['data'][1];
      if ($component['type'] == 'civicrm_contact') {
        $types = array(
          'autocomplete' => t('Contact - Autocomplete'),
          'select' => t('Contact - Select List'),
          'hidden' => $component['extra']['show_hidden_contact'] ? t('Contact - Static') : t('Contact - Hidden'),
        );
        $type = $types[$component['extra']['widget']];
      }
      elseif ($component['type'] == 'select') {
        if ($component['extra']['aslist']) {
          $type = $component['extra']['multiple'] ? t('Multi-select') : t('Select');
        }
        else {
          $type = $component['extra']['multiple'] ? t('Checkboxes') : t('Radio buttons');
        }
      }
      if (in_array($cid, $enabled)) {
        $fields = wf_crm_get_fields();
        $sets = wf_crm_get_fields('sets');
        $class = 'civi-icon';
        list( , $c, $ent, $n, $table, $name) = explode('_', $component['form_key'], 6);
        $field = wf_crm_aval($fields, $table . '_' . $name, array('type' => 'fieldset'));
        // Don't allow CiviCRM fields to be cloned
        $row['data'][6] = '';
        if ($component['type'] == 'fieldset') {
          $title = t('Contact !num', array('!num' => $c));
          $type = t('Fieldset for !contact', array('!contact' => wf_crm_contact_label($c, $data)));
          $row['data'][6] = l(t('Clone Contact'), "node/{$node->nid}/webform/components/$cid/clone", array(
            'attributes' => array('title' => t('Add a new contact to the form with the same fields and settings')
            )));
          $class .= ' fieldset';
        }
        elseif ($ent == 'contact') {
          $field_type = ($table == 'contact' || $table == 'other') ? $field['name'] : $sets[$table]['label'];
          $title = t('!type Field for !contact', array('!contact' => wf_crm_contact_label($c, $data), '!type' => $field_type));
        }
        else {
          $title = t('Field for !type', array('!type' => $sets[$table]['label']));
        }
        if ($table === 'address' && $component['type'] === 'textfield') {
          if ($name === 'state_province_id' || $name === 'county_id') {
            $type = t('AJAX Select');
          }
        }
        if ($component['type'] == 'civicrm_contact' || $component['type'] == 'fieldset') {
          $class .= ' ' . $node->webform_civicrm['data']['contact'][$c]['contact'][1]['contact_type'];
        }
        if ($component['type'] == 'select') {
          $type .= ' (' . (empty($component['extra']['civicrm_live_options']) ? t('static') : t('live')) . ')';
        }
        // Show defaults with labels instead of keys
        if ($component['type'] == 'civicrm_contact') {
          if ($component['extra']['default'] == 'contact_id') {
            $row['data'][2] = check_plain(wf_crm_display_name($component['extra']['default_contact_id']));
          }
          elseif ($component['extra']['default'] == 'user') {
            $row['data'][2] = t('Current User');
          }
          elseif ($component['extra']['default'] == 'auto') {
            $row['data'][2] = t('Auto - From Filters');
          }
          elseif ($component['extra']['default'] == 'relationship' && $component['extra']['default_relationship']) {
            $row['data'][2] = t('Relationship to !contact', array('!contact' => wf_crm_contact_label(1, $data)));
          }
        }
        elseif (isset($component['value']) && strlen($component['value']) && ($field['type'] == 'select' || !empty($field['expose_list']))) {
          if ($component['type'] == 'select') {
            $items = wf_crm_str2array($component['extra']['items']);
          }
          else {
            $items = wf_crm_field_options($component, 'components_form', $node->webform_civicrm['data']);
          }
          $val = '';
          foreach (explode(',', $component['value']) as $v) {
            if (isset($items[trim($v)])) {
              $val .= ($val ? ', ' : '') . $items[trim($v)];
            }
          }
          $row['data'][2] = $val;
        }
        // Contribution page - link to civicrm config form instead of component edit form
        if ($name == 'contribution_page_id') {
          $type = t('CiviCRM Billing Fields');
          $class .= ' contribution';
          $row['data'][5] = l(t('Configure'), 'civicrm/admin/contribute/settings', array(
            'query' => array(
              'reset' => 1,
              'action' => 'update',
              'id' => $component['value'],
            ),
            'attributes' => array(
              'title' => t('Edit Contribution Page in CiviCRM'),
            )
          ));
        }
        $type = array('data' => ' ' . $type, 'title' => $title);
      }
    }
  }
  
  }
  
  **Tags:** webform-civicrm, php
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-12. Score: 0 | Accepted answer
  
  It's important to understand the difference between errors and notices. The message you're seeing says "*Notice* Array to string conversion" so it is not an error. Notices are just info to programmers pointing out something they could do better and are generally harmless. Your Drupal site should be configured to *not* display notices to your users (you can just hide them in the admin settings).
  
  As for what exactly is causing it... I squinted at the line of code you pasted in but don't see anything wrong with it.
  
  
  ---
  
  