I'm developing a solution which allows users to create content through a custom AJAX-driven UI. The first step in the process requires users to pick a content type from a dropdown list, which will then trigger the relevant node form to be loaded in to the page via AJAX. The HTML for the node form is being built correctly, but the issue I'm experiencing is that required JavaScript libraries are not included in the page, e.g. system libraries such as drupal.ajax and jquery.form, and libraries provided by contributed modules such as CKEditor and the media browser provided by the Media module.
Is there an elegant way of determining what libraries are required by node forms for a range of content types before the form is loaded? My intention would be to include all of the libraries using drupal_add_library
, drupal_add_js
and drupal_add_css
in the page callback function for the UI.
Thanks in advance to anyone who has any ideas!