This patch adds a new page to Administer >> Settings called “JavaScript”. On this page, JavaScript enhancements can be toggled. Other modules (like upload.module) can add their own settings via hook_form_alter.

CommentFileSizeAuthor
javascript-settings.patch5.73 KBkkaefer

Comments

nedjo’s picture

This level of control over javascript behaviours seems like something many admins would like.

Some thoughts:

1. I wonder if we could/should consider a standard way for behaviours to describe themselves that would then be loaded and used by this settings page. E.g., hook_behaviors().

2. Somehow directly checking the variables from within the theme function seems awkward. If we don't want a behavior, it seems like it shouldn't arrive at the theme function with the setting that triggers it. How else could we do this? At the form alter stage, e.g. setting a fieldset #collapsible to FALSE based on the variable?

bdragon’s picture

Status: Needs review » Needs work

Autopatch Results:
patching file includes/form.inc
Hunk #1 succeeded at 1111 (offset 139 lines).
Hunk #2 succeeded at 1357 with fuzz 1 (offset 22 lines).
patching file includes/theme.inc
Hunk #1 FAILED at 815.
1 out of 1 hunk FAILED -- saving rejects to file includes/theme.inc.rej
patching file modules/system/system.module
Hunk #1 FAILED at 233.
Hunk #2 succeeded at 755 (offset 48 lines).
1 out of 2 hunks FAILED -- saving rejects to file modules/system/system.module.rej
patching file modules/upload/upload.module
Hunk #1 FAILED at 348.
1 out of 1 hunk FAILED -- saving rejects to file modules/upload/upload.module.rej

wim leers’s picture

Version: 6.x-dev » 7.x-dev

Since this is not really a usability enhancement, marking for D7. I like nedjo's idea to add an additional layer, which gives you more fine-grained control:
1) the FAPI layer
2) the behaviors layer (#behaviors/hook_behaviors() and hook_behaviors_alter()?)
3) the themeing layer

That way, the behaviors can be independent from the themeing layer, which I think is the future. That way you could install a module that completely changes (enhances?) other forms' or form elements' behaviors.
For the people who saw kkaefer's demo of #behaviors for FAPI in Barcelona: #behaviors/hook_behaviors() + hook_behaviors_alter() = magical Drupal UI improvements? (#behaviors in FAPI, hook_behaviors() for behaviors in non-FAPI stuff?)

redndahead’s picture

wim leers’s picture

Version: 7.x-dev » 8.x-dev
nod_’s picture

Component: javascript » base system

I'm not sure core should have that. We should on the contrary provide the minimum JS implementation/styling and let contrib override everything.

I'm tempted to mark that won't fix. Any other opinions?

robloach’s picture

Status: Needs work » Closed (won't fix)

I'm with you. I haven't seen this kind of functionality on any other website system ever.