Replace procedural nested array functions: https://drupal.org/node/1870678

Replace procedural nested array functions as described in following change record: https://drupal.org/node/1870678