Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
javascript
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Dec 2009 at 01:18 UTC
Updated:
29 Jul 2014 at 18:35 UTC
In D7 if pathauto wants to override the 'Path' fieldset summary, there is no solution for this currently.
Comments
Comment #1
dave reidI guess it's not 'impossible' per say, but since in D7 we can have an unlimited number of attached JS files on an element. How does Pathauto know which one is the vertical tabs summary and be easily able to replace it with its own JS.
Like I tried to explain in #625814: Move vertical tabs integration for Flag into flag.module my best solution is to always give the vertical tabs resposible JavaScript a 'vertical-tabs' key in the #attached array.
So instead of:
We do:
That way any other module (like pathauto) can easily do this:
Maybe we should allow multiple JS functions to override each other instead of having to replace the JS. I'm open to ideas.
Comment #2
dmitrig01 commentedYou can override JS functions. Why not just override Drupal.behaviors.pathFieldsetSummaries?
Just make sure that is included after the main path.js. Tempted to mark by design but won't yet
Comment #3
sunAs long as you have a separate (entire) behavior for each summary, overriding the entire JS function is doable.
However, most summaries are buried deeply into other behavior code, or multiple summaries are stacked into the same behavior. Overriding those, in a modular system like Drupal, is technically impossible.
Ideally, we'd have one Drupal.summaries.moduleNameFieldName function per summary that can easily be overridden.
Comment #4
dmitrig01 commentedHm, as a layer on top of .drupalSetSummary?
Comment #5
sunI also don't have a clue yet. Playing live:
That would surely be the simplest way to split them.
More?
I kinda like that one, if it's doable.
Comment #6
sunComment #7
sunOops, wrong issue... anyway, any feedback? Current situation is really bad for modularity.
Comment #8
nod_The summary thing does wierd and wrong things, needs to be refactored. #5 is not ideal (since it's a working around summary) but would work.
Comment #9
droplet commentedI just come up same idea. We have 22 usages in CORE, sharing same pattern of code.
e.g.
- target selector
- decide to show label text or a custom text
I hope it convert to something like:
config able to read from Drupal.settings. also make FORM API to eat these params.
Comment #10
nod_see follow-up in #1751312: Rewrite vertical-tabs.js