Active
Project:
Media Mover
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 May 2010 at 09:54 UTC
Updated:
23 Mar 2012 at 17:09 UTC
Hi,
I was wondering if there is a way to programatically create a configuration for MM? For the sake of Brightcove module, I would like to create a default config that will move files from a filefield to their API and I would like to do that automatically.
Thank you very much,
Jakub
Comments
Comment #1
arthurf commentedYes, you can use the import/export functionality in 6.1x - just write your config and run it through the import submit function. Not ideal, but it works. In 6.2x there will be support for configurations in code.
Comment #2
kobnim commentedArthur,
I am trying to programmatically import a configuration, using 6.x-1.x, and have been struggling with this for quite a while.
When you say "just write your config and run it through the import submit function" ... could you please explain? Which "import submit function" are you referring to?
I have tried calling these functions to convert my configuration to a form:
And I see this function, which submits the form:
function media_mover_api_add_config_form_submit($form, &$form_state)But this is where I am stuck. I do not know how to generate $form_state.
Am I on the right track? Is there a way to generate $form_state? Is there a better approach?
Thanks very much.
Comment #3
kobnim commentedI am now able to programmatically import a configuration, in 6.x-1.x. This is the missing step, which fills $form_state['values'] with the default values from $form:
Comment #4
arthurf commentedSo the note that I made is somewhat vague- when you import your code it dumps you onto the configuration add form- I did this so that there would not be name space collisions. In 6.x-2.x branch this is handled better by ctools and since the configurations have machine names it's much easier to do this right.