I didn't look up how to do this, and there's quite a few name/title thingies.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Here's a patch for Views that shows us how: http://drupal.org/node/1011220#comment-3888838

aspilicious’s picture

I'm on it

aspilicious’s picture

FileSize
3.36 KB

Sadly this wasn't as trivial as the views patch.
I don't know what the exist functions are for these functions.
Couple of todo's

BTW:
Why don't you use #required = true in your forms?

?

aspilicious’s picture

Status: Active » Needs review
merlinofchaos’s picture

Because I use a lot of 'cancel' and 'back' buttons and until very very late in the CTools form code, you could not skip the #required validation. It is bad UX to require someone to fill in a form field in order to cancel it, so for the most part, I dropped #required from my memory as something that is unusable.

merlinofchaos’s picture

The 'exist' function for a page manager page is probably page_manager_page_load()

For the other ones, that might be a little tougher. I don't suppose can can provide arguments to the exists function?

aspilicious’s picture

exists: A function name to invoke for checking whether a submitted machine name value already exists. The submitted value is passed as argument. In most cases, an existing API or menu argument loader function can be re-used. The callback is only invoked, if the submitted value differs from the element's #default_value.

merlinofchaos’s picture

Sigh. Of course not. You'd think that with the rise of entity API someone would've thought about that, so that you could more easily use generic loaders. That means that we're going to have to make export-ui implementions have a specific loader function so they can use this functionality, *or* we're going to have to make our own version of this that can use a more generic loader (like ctools_export_crud_load)

Unless you're really interested in the nuts and bolts of export-ui and export.inc that might be beyond what you want to work on. If that's the case, we can remove the bit for the custom content and I'll make a note to work on that.

aspilicious’s picture

FileSize
1.73 KB

I only go for novice stuff, never saw ctools code before :).
So that second part is FAR beyond my scope/

I *think* I fixed the page manager...

merlinofchaos’s picture

Status: Needs review » Fixed
FileSize
7.89 KB

Thanks for the push, aspilicious!

I got this working generically in export_ui thanks to a last minute patch by sun and eaton that made it possible to use a generic 'exists' function on #machine_name -- looks like this is working just fine on all exportables implemented by CTools and Panels. Yay!

This also revealed a bug in stylizer having to do with $form_state['plugin'] being used for two different purposes.

Actual patch committed attached.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.