$Hi
Is it possible to load a library with hook_field_widget_form?
E.g.
function hook_widget_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$widget['#attached']['libraries_load'][] = array('library_name');
//OR
$widget['#attached'][] = array(
'library' => array(
array('module_name', 'library_name'),
),
);
return $widget;
At least my implementation didn't work so I got wondering that is it even possible?
After all this should be a "form" or at least part of it so therefore it should be processed the same way?
Comments
Comment #2
ETENTION commentedComment #3
tstoecklerThe first option you mention should actually work fine.
If it doesn't please provide some actual code so I can reproduce the problem. Marking fixed in the meantime.