I am making an attempt to attach a subject of a taxonomy time period to a subject in a content material kind, one thing like this:
Auto-Fill from on content material kind to a different
I attempted this on a node and it is working, however now I’ve some issues with Drupal Developer taxonomy time period, is for this half?
// load node by nid $node = node_load($nid);
Do I’ve to specify right here Drupal Developer taxonomy? however I actually do not know what to place in…
Drupal Developer subject in content material kind is “field_descrizione_01” with empty subject “field_udm” Drupal Developer subject with Drupal Developer information in Drupal Developer taxonomy phrases is “field_udm_ti”
I’ve made this code (based mostly on Drupal Developer hyperlink one):
/** * Implements hook_field_widget_form_alter(). */ operate collegamento_field_widget_form_alter(&$ingredient, &$form_state, $context) { if(isset($ingredient['#field_name']) && $ingredient['#field_name'] == 'field_descrizione_01') { $ingredient['#ajax'] = array( 'callback' => 'collegamento_auto_fill_callback', ); } } operate collegamento_auto_fill_callback(&$kind, &$form_state) { $instructions = array(); if(isset($form_state['values']['field_descrizione_01'])) { // get chosen merchandise/node from dropdown checklist $nid = $form_state['values']['field_descrizione_01']['und'][0]['nid']; // load node by nid $node = node_load($nid); if($node) { if(isset($node->field_udm_ti['und'])) { // fill textual content subject $instructions[] = ajax_command_invoke('#edit-field-udm', 'val', array($node->field_udm_ti['und'][0]['value'])); } } } return array('#kind' => 'ajax', '#instructions' => $instructions); }