Warning: strlen() expects parameter 1 to be string, array given in drupal_validate_utf8()
To solve this issue I had to change this line  '#title' =&gt; filter_xss($dimension)['name'], to this On the line '#title' =&gt; filter_xss($dimension['name']),