As I am trying to reduce the complexity of my own Drupal module project I am seeking for some more high-level support concerning the widget rendering. In my opinion it would be nice if the jquery_ui module offers widget templates like this (in case of a dialog):

<div id="<?php print $element['#id']; ?>" title="<?php print $element['#title'];?>"
        style="overflow: auto; display:none;" class="<?php print $element['#class'];?>">
<?php print $element['#children']; ?>
</div>

And initializes the widget options by admin (server-side) settings with javascript like this:

$(this).dialog(options);

To have a simple widget form element initialization in PHP:

$form['dialog'] = array(
    '#id' => 'jquery-ui-dialog-wrapper',
    '#title' => 'Sample dialog',
    '#type' => 'dialog',
  );

For the dialog there would be a link or button necessary to open it.

This should be appliable for all jQuery UI widgets.

Files: 
CommentFileSizeAuthor
#4 jquery_ui_widget-dev.zip12.13 KBgnindl

Comments

Component:User interface» Code
Category:task» feature
Status:Active» Postponed (maintainer needs more info)

Please clarify why this is needed.

I understand what the feature request is, but I am not sure it fits in jQuery UI.
In other words, the requested feature is to implement hook_elements() in the module, so that third-party modules would be allowed to use form elements that use the jQuery UI library for the rendering.

I like the idea, but would not it better to create a different module for this purpose? There are many form elements that could be created to use the jQuery UI library, but there isn't a reason to include all the possible form elements in this module.
Maybe each module should implement the form element it needs, or it could change the attributes associated with the form elements it is using, without even implementing hook_elements().

Title:Widget templatesProvide jquery_ui_elements() for easier usage of plugins in other modules
Status:Postponed (maintainer needs more info)» Active

I think I've understood it now. Makes me worry a lot more about the jQuery UI in core efforts that happen currently.

StatusFileSize
new12.13 KB

Yes, that's right. I meant calling a widget as a FAPI element. Discussion like in this thread Two alternatives for the D7UX overlay implementation worry me a bit because they are putting too much semantics into the core.

Well it could be a separate module, I tried to draft a module called "jQuery UI Widget" some time ago (see attachment). At some point I got stuck and thought it may be a nice-to-have for the jQuery UI module.

What do you guys think? Core, jQuery UI or separate module?

Smoothness theme is hardcoded in the jquery_ui_widget module if you want to test the admin/settings/jquery_ui_widget!

I like the idea of a "jQuery UI widget" module. I think it should be really a separate module with its submodules, as the new form elements you can create from jQuery UI are not just two, or three.

Note that #attached_js and #attached_css are part of the Form API in Drupal 7 now and are being used for the vertical tabs.

Issue tags:+Libraries

Tagging.