Hallo,
I'm managing multiple drupal sites, mostly by deploying custom php scripts with drush, and I'd like to know whether there's a way to set a vocabulary as 'orderable' in code. I checked the module's php, and I don't think there is a function to make it happen, or at least I didn't find it: I was looking for something like
nodeorder_set_orderable($vid)

The module - as far as I can understand - makes a vocabulary orderable through the
nodeorder_taxonomy_form_vocabulary_submit($form, &$form_state)
function. I'm not very good at module/admin interface coding, and I couldn't find out how these two arrays (or objects?) are supposed to look like in this case...

Can anybody help me out?

L.F.

Comments

lucio.ferrari’s picture

Well, I guess I found a possible solution myself, by digging a little deeper into the Forms API:


<?php
module_load_include('inc', 'taxonomy', 'taxonomy.admin', 'nodeorder', 'nodeorder.admin.inc'); // maybe I loaded a bit too much... 

$form = array();
$form['taxonomy'] = taxonomy_form($vid);

$form_state = array ( 
	'values' => array( 
			'vid' => $vid,                                    
			'orderable' => 1,
            'module' => 'taxonomy'	
), );

nodeorder_taxonomy_form_vocabulary_submit($form, $form_state);
?>

seems to do the job.

To revert this, just replace items as 'orderable' => 0, 'module' => 'nodeorder' .

I leave it here in case somebody else is interested.

Regards

L.F.

marcp’s picture

It would be nice if we provided a true API, but that looks good to me.

lucio.ferrari’s picture

Thanks, but I wonder whether the first line actually works...
After I posted this, I met some (unrelated) trouble when I was trying to load content.crud.inc in another script, so I did at last read the API entry for module_load_include.

I believe that the first line only loaded 'taxonomy.admin', and should have been replaced with:

module_load_include('inc', 'taxonomy', 'taxonomy.admin');
module_load_include('inc', 'nodeorder', 'nodeorder.admin');

Nevertheless, it did work... so I guess that loading 'taxonomy.admin' also loads 'nodeorder', probably via its hook_form_alter, thus the second line above is useless. Am I right?

dieuwe’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing as the Drupal 6 branch of this module (and Drupal 6 in general) has been discontinued.