Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | jquery_ui_widget-dev.zip | 12.13 KB | gnindl |
Comments
Comment #1
sunPlease clarify why this is needed.
Comment #2
apadernoI 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()
.Comment #3
sunI think I've understood it now. Makes me worry a lot more about the jQuery UI in core efforts that happen currently.
Comment #4
gnindl CreditAttribution: gnindl commentedYes, 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?
Comment #5
gnindl CreditAttribution: gnindl commentedSmoothness theme is hardcoded in the jquery_ui_widget module if you want to test the admin/settings/jquery_ui_widget!
Comment #6
apadernoI 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.
Comment #7
RobLoachNote that #attached_js and #attached_css are part of the Form API in Drupal 7 now and are being used for the vertical tabs.
Comment #8
sunTagging.
Comment #9
apadernoI am closing this issue, which is for a not supported Drupal version.