I am creating a module that that will create all the required types for the application. I also wan it to setup the automatic node titles with a set formula.
I have the basic install working fine... Custom_type_instal()...but The automatic title generation option is set to disabled. I see in the auto_node title they defined "AUTO_NODETITLE_ENABLED", but I am not sure how to use it.
I also need to select "Automatically generate the title and hide the title field" in the code and set the format "[node:field_custom_1], [node:field_custom_2]"
Any ideas? This is my first post to this forum. I have searched google and found nothing on this. I also didn't get much information from the auto_nodetitle module.
Comments
_
You should be able to use hook_form_alter in your custom module to set those options as desired.
auto_nodetitle method?
I see what you mean with http://websmiths.co/blog/very-introduction-drupals-hookformalter.
function custom_example_form_alter(&$form, &$form_state, $form_id){
// target a single form
if($form_id == "page_node_form"){
$form['title']['#title'] = t('New Form Title');
}
}
This will force a custom title in place, but that isn't exactly what I was looking for.
I would like to continue to use the auto_nodetitle module. I want to have it update the "automatic title generation" to "Automatically generate the title and hide the title field" and add a "pattern for the title" (for example "[node:author] , [node:nid]").
Is there any way to update this through the code? I don't even see which table is holding this information.
_
You should be able to use hook_form_alter to manipulate the auto nodetitle fields directly (similar to what you've done above for the core title field). Your custom module will need to run after auto_nodetitle so you need to change the weight. Then you need to operate on the node settings form to get at those auto nodetitle settings.
This is the closest I could
This is the closest I could find.
http://ericlondon.com/posts/149-overriding-the-node-profile-form-and-aut...
This looks like it will do the same thing, but Still doesn't show how to control auto_nodetitle.
What am I missing? How do I find out where all the arrays are located? I manually set an auto_nodetitle, but couldn't find where it saved it in the database.
Would it be something like this?
function MYMODULE_form_alter(&$form, $form_state, $form_id) {
$form['auto_nodetitle']['ant'][#options] = AUTO_NODETITLE_ENABLED;
$form['auto_nodetitle']['ant_pattern']['#disabled'] = TRUE;
$form['auto_nodetitle']['ant_pattern']['#title'] = node->field1 . ',' . node->field2;
}
i'm not anywhere I can check
i'm not anywhere I can check atm, but yes it would be something like that. Get the devel module (if you don't have it already), and do a
dpm($form);
at the top of your form_alter-- that will show you the entire form. Somewhere in there should be the autonodetitle settings you want to modify.