Closed (fixed)
Project:
Display Suite
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Jul 2011 at 07:50 UTC
Updated:
13 Aug 2011 at 14:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
muka commentedHere is some code, but need to be reviewed as it not works properly.
EDIT: missing redirection after field save
ds/modules/ds_extras/ds_extras.admin.inc ~ line 457
and the callback for ajax
Comment #2
swentel commentedI've been thinking about this for a while as well, but I've always been afraid that adding a new row into the field ui would clutter up the interface, especially if people want to add new dynamic fields, block fields as well. I'd rather go for a solution with a dialog, like you also suggest. Just need to find a nice spot for that in the interface and see if I can dynamically update the field ui - which will be hard, so might be a refresh, but still, better that nothing.
- edit - the CTools wizard is probably a handy feature for this, I'll have a look at this next week.
- edit 2 - your technique is adding the form in the additional settings which is probably a good idea, I'll have a look at the code you posted and see if I can make it work.
Comment #3
swentel commentedWaauw, been playing with your code and it really is already freakingly cool :)
I've attached patch in progress in case other people want to start testing with this as well. Did some code cleanup (mostly code standards) and also added the preprocess field (new in dev). Patch applies to latest dev.
- edit -
* two things are missing:
- show errors in form (eg missing label, unique field)
- redirect after correct save
Comment #4
swentel commentedchanging status just to draw attention to other users maybe.
Comment #5
sunYou have to use http://api.drupal.org/api/drupal/includes--form.inc/function/form_load_i... here instead.
Don't forget to take &$form_state by reference.
Comment #6
muka commentedHi, I've moved the code to a ctools modal avoiding some strangeness in the form building.
I've got two points of doubt in the code, in line 175 and 200 in the patch attached.
* I use $_POST instead $form_state, I can't find how to get it
* Field UI regeneration creates a form_id--N which break the js functionality; still a form_build problem I think
Patch is built upon the latest 7.x-1.x dev branch.
Thanks in advance.
Comment #7
swentel commentedCool stuff. Updated patch attached with simplied code (on latest dev).
Instead of calling the form after the field save, I'm triggering a ds javascript event which now reloads the page. This is the only thing left which is not 'that' nice. If we could somehow trigger the #edit-refresh button with a row to refresh the table with ajax than we're there. I'll ping yched about this to see if he can shed some light on this. Other than that, this patch is 99% good to go.
Comment #8
swentel commentedCommitted this. A field save triggers the save button so any other changes in the table are saved as well and the new field will show up too.
Comment #9
muka commentedThanks!
Just in case, I've added a raw refresh $.get-ing the same document.location and reattaching behaviors.