0

Is there any way to make the language choice required for taxonomy term.

I'm pretty sure there is a way to perform this.

Otherwise, how can I at least set a default language choice for my taxonomy. By exemple, I would like to make English as default language. That's mean when the user will create a term the first time, the language choice will be english.

Thanks a lot

1
  • What modules are you using for the language choice?
    – SDMulroy
    Jul 1, 2014 at 15:06

1 Answer 1

1

Write a custom module and use the following code

function MYMODULE_form_alter(&$form, &$form_state, $form_id){
  if($form_id=='taxonomy_form_term'){
     $form['#after_build'][] = 'MYMODULE_after_build';
  }
}

function MYMODULE_after_build($form, &$form_state) {
   if($form['language']['#value']=='und'){
     $form['language']['#default_value']='en';
     $form['language']['#value']='en';
   }
   return $form;

}

NOTE: In your custom_module.info file use this dependencies[] = i18n_taxonomy, so that your module can only be enabled if internationalization is enabled

1
  • Thanks a lot wolverine :) please see my other question if you can :) Jul 1, 2014 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.