I created a list Views to specific nodes, but when I select the formatter "Services Raw" in the fields, their value are not displayed when I view the service, just the Preview of the Views interface.

Service Output in browser:

[{"nid":"6","uuid":"bcce3128-fce0-46f8-a5e8-1dff0a66d4e6","titulo":"Sobre o Evento","body":"<p>Phosfluorescently pursue out-of-the-box total linkage without resource-leveling information. Holisticly fashion competitive outsourcing without bleeding-edge customer service. Rapidiously exploit accurate bandwidth through visionary customer service. Globally disseminate equity invested leadership for mission-critical mindshare. Holisticly syndicate unique initiatives for sticky processes.</p>\n\n<p>Interactively target highly efficient communities rather than flexible niches. Appropriately expedite value-added bandwidth whereas 2.0 technology. Holisticly morph cross-media testing procedures via resource sucking services. Monotonectally promote fully tested testing procedures vis-a-vis alternative e-commerce. Interactively unleash bleeding-edge products rather than error-free bandwidth.</p>\n\n<p>Globally redefine world-class partnerships and end-to-end initiatives. Dramatically integrate cross-platform sources whereas strategic ideas. Objectively predominate value-added content before installed base outsourcing. Holisticly negotiate enterprise e-tailers with functional core competencies. Credibly actualize clicks-and-mortar partnerships vis-a-vis multifunctional models.</p>\n\n<p>Globally extend impactful imperatives after team driven outsourcing. Progressively productivate inexpensive paradigms rather than low-risk high-yield products. Authoritatively generate resource sucking \"outside the box\" thinking through scalable functionalities. Uniquely revolutionize orthogonal process improvements rather than exceptional infomediaries. Proactively mesh economically sound ROI before extensive leadership.</p>\n\n<p>Interactively restore high standards in services before effective content. Globally extend an expanded array of schemas rather than clicks-and-mortar partnerships. Dynamically fabricate maintainable leadership through orthogonal niche markets. Quickly re-engineer professional customer service whereas scalable leadership. Competently aggregate dynamic technologies via vertical partnerships.</p>\n","img":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","geo":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"}]

Views export code:

$view = new view();
$view->name = 'services_content';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Services - Content';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'mais';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Aplicar';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Reiniciar';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Ordenar por';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Ascendente';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Decrescente';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = TRUE;
/* Campo: Conteúdo: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = 'nid';
$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE;
/* Campo: Conteúdo: Node UUID */
$handler->display->display_options['fields']['uuid']['id'] = 'uuid';
$handler->display->display_options['fields']['uuid']['table'] = 'node';
$handler->display->display_options['fields']['uuid']['field'] = 'uuid';
$handler->display->display_options['fields']['uuid']['label'] = 'uuid';
/* Campo: Conteúdo: Título */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = 'titulo';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Campo: Conteúdo: Corpo */
$handler->display->display_options['fields']['field_body']['id'] = 'field_body';
$handler->display->display_options['fields']['field_body']['table'] = 'field_data_field_body';
$handler->display->display_options['fields']['field_body']['field'] = 'field_body';
$handler->display->display_options['fields']['field_body']['label'] = 'body';
$handler->display->display_options['fields']['field_body']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
/* Campo: Campo: Imagem */
$handler->display->display_options['fields']['field_img']['id'] = 'field_img';
$handler->display->display_options['fields']['field_img']['table'] = 'field_data_field_img';
$handler->display->display_options['fields']['field_img']['field'] = 'field_img';
$handler->display->display_options['fields']['field_img']['label'] = 'img';
$handler->display->display_options['fields']['field_img']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_img']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_img']['type'] = 'services';
$handler->display->display_options['fields']['field_img']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
/* Campo: Conteúdo: Geo-posição */
$handler->display->display_options['fields']['field_geo_position']['id'] = 'field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['table'] = 'field_data_field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['field'] = 'field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['label'] = 'geo';
$handler->display->display_options['fields']['field_geo_position']['click_sort_column'] = 'geom';
$handler->display->display_options['fields']['field_geo_position']['type'] = 'services';
$handler->display->display_options['fields']['field_geo_position']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
/* Critério de filtragem: Conteúdo: Publicado */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critério de filtragem: Conteúdo: Tipo */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'pagina' => 'pagina',
);
/* Critério de filtragem: Conteúdo: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['exposed'] = TRUE;
$handler->display->display_options['filters']['nid']['expose']['operator_id'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['label'] = 'Nid';
$handler->display->display_options['filters']['nid']['expose']['operator'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['identifier'] = 'nid';
$handler->display->display_options['filters']['nid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
);

/* Display: Páginas */
$handler = $view->new_display('services', 'Páginas', 'content_pagina');
$handler->display->display_options['path'] = 'content_pagina';

/* Display: Noticias */
$handler = $view->new_display('services', 'Noticias', 'content_noticia');
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Campo: Conteúdo: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = 'nid';
/* Campo: Conteúdo: Node UUID */
$handler->display->display_options['fields']['uuid']['id'] = 'uuid';
$handler->display->display_options['fields']['uuid']['table'] = 'node';
$handler->display->display_options['fields']['uuid']['field'] = 'uuid';
$handler->display->display_options['fields']['uuid']['label'] = 'UUID';
/* Campo: Conteúdo: Título */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Campo: Conteúdo: Corpo */
$handler->display->display_options['fields']['field_body']['id'] = 'field_body';
$handler->display->display_options['fields']['field_body']['table'] = 'field_data_field_body';
$handler->display->display_options['fields']['field_body']['field'] = 'field_body';
$handler->display->display_options['fields']['field_body']['label'] = 'body';
$handler->display->display_options['fields']['field_body']['type'] = 'services';
$handler->display->display_options['fields']['field_body']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
/* Campo: Campo: Imagem */
$handler->display->display_options['fields']['field_img']['id'] = 'field_img';
$handler->display->display_options['fields']['field_img']['table'] = 'field_data_field_img';
$handler->display->display_options['fields']['field_img']['field'] = 'field_img';
$handler->display->display_options['fields']['field_img']['label'] = 'img';
$handler->display->display_options['fields']['field_img']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_img']['type'] = 'services';
$handler->display->display_options['fields']['field_img']['settings'] = array(
  'skip_safe' => 0,
  'skip_empty_values' => 1,
);
/* Campo: Conteúdo: Arquivos Anexados */
$handler->display->display_options['fields']['field_anexos']['id'] = 'field_anexos';
$handler->display->display_options['fields']['field_anexos']['table'] = 'field_data_field_anexos';
$handler->display->display_options['fields']['field_anexos']['field'] = 'field_anexos';
$handler->display->display_options['fields']['field_anexos']['label'] = 'anexos';
$handler->display->display_options['fields']['field_anexos']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_anexos']['type'] = 'services';
$handler->display->display_options['fields']['field_anexos']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
$handler->display->display_options['fields']['field_anexos']['delta_offset'] = '0';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Critério de filtragem: Conteúdo: Publicado */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critério de filtragem: Conteúdo: Tipo */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'noticia' => 'noticia',
);
/* Critério de filtragem: Conteúdo: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['exposed'] = TRUE;
$handler->display->display_options['filters']['nid']['expose']['operator_id'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['label'] = 'Nid';
$handler->display->display_options['filters']['nid']['expose']['operator'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['identifier'] = 'nid';
$handler->display->display_options['filters']['nid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
);
$handler->display->display_options['path'] = 'content_noticia';

/* Display: Hoteis */
$handler = $view->new_display('services', 'Hoteis', 'content_hotel');
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Campo: Conteúdo: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = 'nid';
/* Campo: Conteúdo: Node UUID */
$handler->display->display_options['fields']['uuid']['id'] = 'uuid';
$handler->display->display_options['fields']['uuid']['table'] = 'node';
$handler->display->display_options['fields']['uuid']['field'] = 'uuid';
$handler->display->display_options['fields']['uuid']['label'] = 'UUID';
/* Campo: Conteúdo: Título */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Campo: Conteúdo: Corpo */
$handler->display->display_options['fields']['field_body']['id'] = 'field_body';
$handler->display->display_options['fields']['field_body']['table'] = 'field_data_field_body';
$handler->display->display_options['fields']['field_body']['field'] = 'field_body';
$handler->display->display_options['fields']['field_body']['label'] = 'body';
$handler->display->display_options['fields']['field_body']['type'] = 'services';
$handler->display->display_options['fields']['field_body']['settings'] = array(
  'skip_safe' => 1,
  'skip_empty_values' => 1,
);
/* Campo: Campo: Imagem */
$handler->display->display_options['fields']['field_img']['id'] = 'field_img';
$handler->display->display_options['fields']['field_img']['table'] = 'field_data_field_img';
$handler->display->display_options['fields']['field_img']['field'] = 'field_img';
$handler->display->display_options['fields']['field_img']['label'] = 'img';
$handler->display->display_options['fields']['field_img']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_img']['type'] = 'services';
$handler->display->display_options['fields']['field_img']['settings'] = array(
  'skip_safe' => 0,
  'skip_empty_values' => 1,
);
/* Campo: Conteúdo: Geo-posição */
$handler->display->display_options['fields']['field_geo_position']['id'] = 'field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['table'] = 'field_data_field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['field'] = 'field_geo_position';
$handler->display->display_options['fields']['field_geo_position']['label'] = 'geo';
$handler->display->display_options['fields']['field_geo_position']['click_sort_column'] = 'geom';
$handler->display->display_options['fields']['field_geo_position']['type'] = 'geofield_geojson';
$handler->display->display_options['fields']['field_geo_position']['settings'] = array(
  'data' => 'centroid',
);
/* Campo: Conteúdo: Diárias a partir de */
$handler->display->display_options['fields']['field_diarias']['id'] = 'field_diarias';
$handler->display->display_options['fields']['field_diarias']['table'] = 'field_data_field_diarias';
$handler->display->display_options['fields']['field_diarias']['field'] = 'field_diarias';
$handler->display->display_options['fields']['field_diarias']['label'] = 'diaria';
$handler->display->display_options['fields']['field_diarias']['settings'] = array(
  'thousand_separator' => ' ',
  'decimal_separator' => '.',
  'scale' => '2',
  'prefix_suffix' => 1,
);
/* Campo: Conteúdo: Telefone */
$handler->display->display_options['fields']['field_telefone']['id'] = 'field_telefone';
$handler->display->display_options['fields']['field_telefone']['table'] = 'field_data_field_telefone';
$handler->display->display_options['fields']['field_telefone']['field'] = 'field_telefone';
$handler->display->display_options['fields']['field_telefone']['label'] = 'telefone';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Critério de filtragem: Conteúdo: Publicado */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critério de filtragem: Conteúdo: Tipo */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'hotel' => 'hotel',
);
/* Critério de filtragem: Conteúdo: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['exposed'] = TRUE;
$handler->display->display_options['filters']['nid']['expose']['operator_id'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['label'] = 'Nid';
$handler->display->display_options['filters']['nid']['expose']['operator'] = 'nid_op';
$handler->display->display_options['filters']['nid']['expose']['identifier'] = 'nid';
$handler->display->display_options['filters']['nid']['expose']['remember_roles'] = array(
  2 => '2',
  1 => 0,
);
$handler->display->display_options['path'] = 'content_hoteis';
$translatables['services_content'] = array(
  t('Master'),
  t('mais'),
  t('Aplicar'),
  t('Reiniciar'),
  t('Ordenar por'),
  t('Ascendente'),
  t('Decrescente'),
  t('nid'),
  t('uuid'),
  t('titulo'),
  t('body'),
  t('img'),
  t('geo'),
  t('Nid'),
  t('Páginas'),
  t('Noticias'),
  t('UUID'),
  t('anexos'),
  t('Hoteis'),
  t('diaria'),
  t('telefone'),
);

Views Preview Output:

array (
  0 => 
  stdClass::__set_state(array(
     'nid' => '6',
     'uuid' => 'bcce3128-fce0-46f8-a5e8-1dff0a66d4e6',
     'titulo' => 'Sobre o Evento',
     'body' => '
Phosfluorescently pursue out-of-the-box total linkage without resource-leveling information. Holisticly fashion competitive outsourcing without bleeding-edge customer service. Rapidiously exploit accurate bandwidth through visionary customer service. Globally disseminate equity invested leadership for mission-critical mindshare. Holisticly syndicate unique initiatives for sticky processes.



Interactively target highly efficient communities rather than flexible niches. Appropriately expedite value-added bandwidth whereas 2.0 technology. Holisticly morph cross-media testing procedures via resource sucking services. Monotonectally promote fully tested testing procedures vis-a-vis alternative e-commerce. Interactively unleash bleeding-edge products rather than error-free bandwidth.



Globally redefine world-class partnerships and end-to-end initiatives. Dramatically integrate cross-platform sources whereas strategic ideas. Objectively predominate value-added content before installed base outsourcing. Holisticly negotiate enterprise e-tailers with functional core competencies. Credibly actualize clicks-and-mortar partnerships vis-a-vis multifunctional models.



Globally extend impactful imperatives after team driven outsourcing. Progressively productivate inexpensive paradigms rather than low-risk high-yield products. Authoritatively generate resource sucking "outside the box" thinking through scalable functionalities. Uniquely revolutionize orthogonal process improvements rather than exceptional infomediaries. Proactively mesh economically sound ROI before extensive leadership.



Interactively restore high standards in services before effective content. Globally extend an expanded array of schemas rather than clicks-and-mortar partnerships. Dynamically fabricate maintainable leadership through orthogonal niche markets. Quickly re-engineer professional customer service whereas scalable leadership. Competently aggregate dynamic technologies via vertical partnerships.


',
     'img' => 
    array (
      'fid' => '5',
      'uid' => '1',
      'filename' => 'img-de-destaque.jpg',
      'uri' => 'public://uploads/pagina/6/img-de-destaque.jpg',
      'filemime' => 'image/jpeg',
      'filesize' => '71720',
      'status' => '1',
      'timestamp' => '1403175415',
      'origname' => 'estacao-ciencias-cultura-artes-cabo-branco-joao-pessoa.jpg',
      'uuid' => 'e48735eb-eba8-485a-ab98-3226545cf0fa',
      'width' => '576',
      'height' => '384',
    ),
     'geo' => 
    array (
      'geom' => 'POINT (-34.797995 -7.149378)',
      'geo_type' => 'point',
      'lat' => '-7.149378000000',
      'lon' => '-34.797995000000',
      'left' => '-34.797995000000',
      'top' => '-7.149378000000',
      'right' => '-34.797995000000',
      'bottom' => '-7.149378000000',
      'geohash' => '7nxr24kzggq7',
    ),
  )),
)

Plus, I get a lot of these warnings after reload the REST resource, and soon after reload a Drupal page:

Warning: Invalid argument supplied for foreach() in element_children() (line 6433 of /www/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 5898 of /www/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 5908 of /www/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 5946 of /www/includes/common.inc).
Warning: Illegal string offset '#printed' in drupal_render() (line 5953 of /www/includes/common.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Marcus VBP’s picture

Issue summary: View changes
meba’s picture

COnfirmed, happens with Media entities too

jantoine’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
800 bytes

I ran into this same issue when using core term_reference fields. The problems seems to stem from the fact that the result returned was an array of arrays rather than an array of single values. The attached patch detects if a column is set on the field and if each item is an array, and if so, uses the column to return the value of the array rather than the array itself. I have only tested this with term_reference fields, so it should be tested with all other core fields along with the entity_reference field.

jantoine’s picture

My previous patch was incorrect and resulted in incorrect values being returned. It turns out that the item values should be renderable arrays as they are passed to the drupal_render() function. The problem seems to be that the module is not supplying enough information to actually render the value. The attached patch sets the type to 'markup' and sets the value to the '#markup' key. This may not be correct, but it's the only type I could get to work.

DarkteK’s picture

#4 worked for me really great, please include this in the next version :)

ahmed.raza’s picture

Having the same problem patch #4 didn't work for me :( please help

othermachines’s picture

Status: Needs review » Needs work

This needs a reroll.

Brolad’s picture

Status: Needs work » Needs review
FileSize
505 bytes
thedut’s picture

#8 fix the issue for me.

rossb89’s picture

Yup, #8 solves the issue.

rossb89’s picture

Status: Needs review » Reviewed & tested by the community
Rishi Kulshreshtha’s picture

#8 solves the issue, please include this in the next version :)

ice70’s picture

Hi,

I was having the same problem, applied the patch in #8 and now I have the following

Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1422 of \sites\all\modules\contrib\views\handlers\views_handler_field.inc).

Notice: Array to string conversion in drupal_render() (line 6075 of \includes\common.inc)

the JSON feed looks ok, but I am filling up my log with these errors?
Any ideas?

Thank you for your help
ice70

ice70’s picture

Hi,

I am seeing a similar error pattern.

For this error:
Notice: Array to string conversion in drupal_render() (line 6075 of \includes\common.inc)
which is:
$output = $prefix . $elements['#children'] . $suffix;

I am using bootstrap & media modules and when I have an image in the view data, $elements is as follows:

array (
  '#type' => 'markup',
  '#markup' => 
  array (
    'height' => 262,
    'width' => 349,
  ),
  '#pre_render' => 
  array (
    0 => 'drupal_pre_render_markup',
    1 => 'ctools_dependent_pre_render',
    2 => 'bootstrap_pre_render',
  ),
  '#icon' => NULL,
  '#icon_position' => 'before',
  '#process' => 
  array (
    0 => 'bootstrap_form_process',
  ),
  '#children' => 
  array (
    'height' => 262,
    'width' => 349,
  ),
  '#smart_description' => false,
)

the view field export is as follows:

/* Field: Content: Listing Only Image */
$handler->display->display_options['fields']['field_listing_only_image']['id'] = 'field_listing_only_image';
$handler->display->display_options['fields']['field_listing_only_image']['table'] = 'field_data_field_listing_only_image';
$handler->display->display_options['fields']['field_listing_only_image']['field'] = 'field_listing_only_image';
$handler->display->display_options['fields']['field_listing_only_image']['label'] = 'thumbnail_url';
$handler->display->display_options['fields']['field_listing_only_image']['empty'] = '[field_listing_only_image]';
$handler->display->display_options['fields']['field_listing_only_image']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_listing_only_image']['type'] = 'services';
$handler->display->display_options['fields']['field_listing_only_image']['settings'] = array(
  'data_element_key' => '',
  'skip_safe' => 0,
  'skip_empty_values' => 0,
);

any ideas on how to make #children a string, not an array?

Thank you for any help,
ice70

ice70’s picture

Hi,

in
services_views.module: services_views_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display)

we go through a loop for a media image with services raw output:
$element[$delta] = $filtered_item;

$filtered_item contains:

$filtered_item[metadata][#markup][width]
$filtered_item[metadata][#markup][height]
$filtered_item[matatags][#markup][und]
$filtered_item[path][#markup][pathauto]

causing "Notice: Array to string conversion in drupal_render()"

Any suggestions on how to prevent this?

thank you for your help,
ice70

karthid’s picture

Try this one.

if(!is_array($val)) {
          $filtered_item[$key] = array(
            '#type' => 'markup',
            '#markup' => $val,
          );
        }
Liam Morland’s picture

Category: Support request » Bug report
bisonbleu’s picture

Status: Reviewed & tested by the community » Needs review

Ran into issue reported in #14.
Code in #16 fixed this issue.

Thanks @karthid !

fakir22’s picture

I was having same warnings that #1 and the patch in #8 fixed the issue for me.

Liam Morland’s picture

@bisonbleu; Could you write-up a patch of what you did?

bisonbleu’s picture

Sure thing @Liam Morland. Cheers.

arled’s picture

This fixes the warnings but breaks the services output settings. You are always left with #markup and can't produce clean output. I would not recommend this as the solution. And what's with pasting so much code!!

bisonbleu’s picture

@arled , care to share what you would recommend?

zuhair_ak’s picture

@arled Do you have any other solution than the one in the patch? Thanks.

sepa_cleversoft’s picture

#8 worked well for me!! Thanks!! please add in next version.

Brolad’s picture

#8 can solve the issue but the patch is wrong, need to make some changes

zuhair_ak’s picture

Could you give some pointers on what are the changes to be made?

Getekid’s picture

Hello everyone,

I stumbled upon this error as well and I discovered that the output of the formatter has no effect whatsoever, i.e. in services_views_field_formatter_view even if you return:

return array(
  0 => array(
    '#type' => 'markup',
    '#markup' => 'Hello World',
  )
);

the output in both the View preview and the final service output will be the actual field content, with no errors, too.

I haven't figured out the code completely, but by looking at the services_views_execute_view function (under "services_views.resource.inc") it seems that as long as the field is in the row results and has the services formatter, it will still append all the field content ("skip_safe" and "skip_empty_values" are still checked) to the final outcome, regardless of the formatter output.

If that's the case maybe the formatter is unnecessary and a view field option would suffice to output the raw content of the field.

solideogloria’s picture

You shouldn't use '#type' => 'markup'. The property was removed and never actually did anything.

https://www.drupal.org/node/2036237

Liam Morland’s picture

markup is a valid #type. It is also the default so there is no need to declare it.

https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...

Liam Morland’s picture

University of Waterloo has been running #8 for over three years now. However, I note there are now test failures.

The failures are on the branch, not related to the patches in this issue.

solideogloria’s picture

Issue summary: View changes

Removing duplicate warnings to reduce size of initial post.

Liam Morland’s picture