This issue happens when you preview a node that has a link field.
I believe that the attribute is still an array at this stage and is not yet serialised.
One way to fix it is to change the code like this:

 if (isset($item['attributes'])) {
    if(is_string($item['attributes'])){
      return unserialize($item['attributes']);
    } else {
      return $item['attributes'];
    }
  }

Comments

JKingsnorth’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

I cannot recreate the issue in the latest version, and since it is against an older version I'm going to close this off. Please do reopen it with full steps about how to recreate the issue in the latest version if it is still a problem.