Skip to main content
Commonmark migration
Source Link

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

 

Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc).

 

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

 

Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc).

 

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc).

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

Bumped by Community user
added 9 characters in body; edited tags
Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning

Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc). 

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc). PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc).

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc). 

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).

Source Link

Field API field_schema for text field error

I've built a custom field using the Field API. I've defined the following element:

  $element['tabcontent'] = array(
    '#title' => t('Tab content'),
    '#type' => 'text_format',
    '#required' => $required,
    // use #default_value to prepopulate the element
    // with the current saved value
    '#default_value' => isset($item['tabcontent']) ? $item['tabcontent'] : '',
    '#tree' => true,
    '#rows' => 10,
    '#format' => 'full_html',
    '#base_type' => 'textarea',
  );

I've got the following code in the install file:

function tabfield_field_schema($field) 
{
 
  $columns = array(
    'tabtitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'tabcontent' => array('type' => 'text','not null' => TRUE,'size' => 'normal','description' => 'Question prompt','length' => '1000'  ),
  );


  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}

However, I get the following error when saving a new node:

Warning: preg_match_all() expects parameter 2 to be string, array given in _media_generate_tagMap() (line 186 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning: Invalid argument supplied for foreach() in _media_generate_tagMap() (line 187 of C:\Workspace\RnD\drupal1\sites\all\modules\media\includes\media.filter.inc). Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1572 of C:\Workspace\RnD\drupal1\includes\bootstrap.inc). PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_tab} (entity_type, entity_id, revision_id, bundle, delta, language, field_tab_tabtitle, field_tab_tabcontent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7_value, :db_insert_placeholder_7_format); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 17 [:db_insert_placeholder_2] => 17 [:db_insert_placeholder_3] => tabbed_page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ss [:db_insert_placeholder_7_value] => ss [:db_insert_placeholder_7_format] => full_html ) in field_sql_storage_field_storage_write() (line 448 of C:\Workspace\RnD\drupal1\modules\field\modules\field_sql_storage\field_sql_storage.module).