I'm using the Location Taxonomize module with the Address Field module to create a vocabulary of node locations.
I want to re-create the locations from scratch, and I have a term reference field attached to the node. This term reference field contains a reference to the automatically generated Location Taxonomize vocabulary.
The problem is, after I delete the vocabulary and term reference field and then re-create them, I cannot use VBO to re-save my nodes to automatically generate the Location Taxonomize terms and fill in the term reference fields. Instead, I have to save the nodes one-by-one, but there are 30,000+ nodes.
In other words: saving nodes individually works fine, but saving nodes in bulk does nothing.
The relevant code from Location Taxonomize Address Field submodule looks like this:
function location_taxonomize_af_element_submitted($form, &$form_state) {
$lang = 'und';
// Act on values
$fields = $form_state['temporary']['addressfields'];
$items = array();
foreach ($fields as $field) {
$deltas = $form_state['values'][$field][$lang];
foreach ($deltas as $delta => $values) {
// Don't process 'add more'.
if (is_numeric($delta)) {
// Add the Administrative Area name, if possible
if (isset($form[$field][$lang][$delta]['locality_block']['administrative_area']['#options'])) {
$options = $form[$field][$lang][$delta]['locality_block']['administrative_area']['#options'];
$values['administrative_area_name'] = $options[$values['administrative_area']];
}
// Add the country name
$values['country_name'] = location_taxonomize_get_country_name($values['country']);
$items[] = $values;
}
}
}
// taxonomize
if (!empty($items)) {
location_taxonomize_taxonomize($items, $form, $form_state);
}
}
As far as I can tell, this code is added by a submit handler, so when the nodes are re-saved using VBO, the submit handler is not called (I could be wrong about this; I am in over my head in this part of Drupal). What I want to do is force this bit of code to be called with VBO-- I know how to make a Rules action in code, but for nodes, that gives me the variable $node
, not $form
. Is there some way to go from $node
to $form
to run this code? Or, is there some way to re-save a node in a bulk operation as if it were saved individually?