What I Learned Today: Drupal #attached Awesomeness
What is #attached
There are three different child keys of #attached in use here:
As If That Isn't Awesome Enough
What I didn't know until recently, is that library, css and js are not the only keys you can pass. You can actually pass any arbitrary key you want, and it will be used as a callback function, receiving as arguments the values of its array. Here is an example from the documentation for drupal_process_attached().
So when drupal_process_attached runs, it will call:
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
Another example might be:
The possibilities are endless!