Replace procedural nested array functions, use $form_state['controller']

- Replace procedural nested array functions as described in following change record: https://drupal.org/node/1870678
- Use the new $form_state['controller'] to fetch the form entity.