| 
														
															@@ -687,7 +687,7 @@ function tode_entity_add_form_submit($form, &$form_state){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-function _tode_entity_add_form($js = FALSE, $bundle, $entity) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+function BAD_ONE_tode_entity_add_form($js = FALSE, $bundle, $entity) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// dsm('- - - - tode_entity_add_form'); 
														 | 
														
														 | 
														
															 	// dsm('- - - - tode_entity_add_form'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	//   dsm($bundle, '$bundle'); 
														 | 
														
														 | 
														
															 	//   dsm($bundle, '$bundle'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	//   dsm($entity, '$entity'); 
														 | 
														
														 | 
														
															 	//   dsm($entity, '$entity'); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -773,7 +773,7 @@ function tode_field_widget_form_alter(&$element, &$form_state, $context) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					foreach ($entities as $entity) { 
														 | 
														
														 | 
														
															 					foreach ($entities as $entity) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						$tode_instance = $type_fields[$entity][$tode['field_name']]; 
														 | 
														
														 | 
														
															 						$tode_instance = $type_fields[$entity][$tode['field_name']]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						 
														 | 
														
														 | 
														
															 						 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-						$btn = ctools_modal_text_button(t('create a new %s', array('%s'=>$entity)), 'tode/nojs/add/'.$bundle.'/'.$entity.'/'.$tode_instance['label'], t('alt'), "ctools-modal-tode-add-modal") . "\n"; // modal-popup-small 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						$btn = ctools_modal_text_button(t('create a new %s', array('%s'=>$entity)), 'tode/nojs/add/'.$bundle.'/'.$entity.'/'.$tode_instance['label'], t('alt'), "button ctools-modal-tode-add-modal") . "\n"; // modal-popup-small 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						// $btn .= ctools_modal_text_button(t('create new test'), 'tode/nojs/add/node/test', t('alt')); 
														 | 
														
														 | 
														
															 						// $btn .= ctools_modal_text_button(t('create new test'), 'tode/nojs/add/node/test', t('alt')); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					// dsm($btn); 
														 | 
														
														 | 
														
															 					// dsm($btn); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						if($element['#suffix'] == '') 
														 | 
														
														 | 
														
															 						if($element['#suffix'] == '') 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -789,26 +789,24 @@ function tode_field_widget_form_alter(&$element, &$form_state, $context) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			 
														 | 
														
														 | 
														
															 			 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   		$throbber = theme('image', array('path' => ctools_image_path('loading_animation.gif', 'modal_forms'), 'alt' => t('Loading...'), 'title' => t('Loading'))); 
														 | 
														
														 | 
														
															   		$throbber = theme('image', array('path' => ctools_image_path('loading_animation.gif', 'modal_forms'), 'alt' => t('Loading...'), 'title' => t('Loading'))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			$js_settings = array( 
														 | 
														
														 | 
														
															 			$js_settings = array( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					    'tode-add-modal' => array( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      'modalSize' => array( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					        'type' => 'fixed', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					        'width' => 500, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					        'height' => 200, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      ), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      'modalOptions' => array( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					        'opacity' => 0.4, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					        'background' => '#000', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      ), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      'animation' => 'fadeIn', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      // 'modalTheme' => 'ModalFormsPopup', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      'throbber' => $throbber, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					      'closeText' => t('Close'), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					    ), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					  ); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					  drupal_add_js($js_settings, 'setting'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		    'tode-add-modal' => array( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      'modalSize' => array( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		        'type' => 'fixed', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		        'width' => 500, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		        'height' => 200, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      ), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      'modalOptions' => array( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		        'opacity' => 0.4, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		        'background' => '#000', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      ), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      'animation' => 'fadeIn', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      // 'modalTheme' => 'ModalFormsPopup', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      'throbber' => $throbber, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		      'closeText' => t('Close'), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		    ), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		  ); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			 
														 | 
														
														 | 
														
															 			 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		  drupal_add_js($js_settings, 'setting'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			 
														 | 
														
														 | 
														
															 			 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			$element['#prefix'] = '<div class="tode-add-modal-wrapper">'; 
														 | 
														
														 | 
														
															 			$element['#prefix'] = '<div class="tode-add-modal-wrapper">'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			$element['#suffix'] .= '</div></div>'; 
														 | 
														
														 | 
														
															 			$element['#suffix'] .= '</div></div>'; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -947,43 +945,44 @@ function tode_delete_submit($form, &$form_state){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * Implements hook_url_outbound_alter(). 
														 | 
														
														 | 
														
															  * Implements hook_url_outbound_alter(). 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  */ 
														 | 
														
														 | 
														
															  */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 function tode_url_outbound_alter(&$path, &$options, $original_path) { 
														 | 
														
														 | 
														
															 function tode_url_outbound_alter(&$path, &$options, $original_path) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	// dsm($path); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	# terms url 
														 | 
														
														 | 
														
															 	# terms url 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (preg_match('/^taxonomy\/term\/([0-9]*)$/', $path, $matches)) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		$term = taxonomy_term_load($matches[1]); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		// dsm($term, '$term'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		$vocabulary = taxonomy_vocabulary_load($term->vid); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		// dsm($vocabulary, '$vocabulary'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if(isset($options['entity_type']) && $options['entity_type'] == 'taxonomy_term'){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		// dsm('- - - - tode_url_outbound_alter'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		// dsm($path, '$path'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		// dsm($options, '$options'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		// dsm($original_path, '$original_path'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		 
														 | 
														
														 | 
														
															 		 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		if($field = _tode_get_voc_tode_fields_def($vocabulary->machine_name)){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			// dsm($field, '$field'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			// $existing_item = db_query('SELECT * FROM {menu_links} WHERE mlid = :mlid', array('mlid' => $item['mlid']))->fetchAssoc(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		$term = $options['entity']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		if($field = _tode_get_voc_tode_fields_def($term->vocabulary_machine_name)){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			$sr = $field['storage']['details']['sql']['FIELD_LOAD_CURRENT']; 
														 | 
														
														 | 
														
															 			$sr = $field['storage']['details']['sql']['FIELD_LOAD_CURRENT']; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			foreach ($sr as $table => $column) { 
														 | 
														
														 | 
														
															 			foreach ($sr as $table => $column) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				$query = db_select($table, 'ft') 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				$query = db_select($table, 'ft'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				$query->join('node', 'n', 'ft.entity_id = n.nid AND n.language = :language', array(':language' => $options['language']->language)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				$query 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				  ->fields('ft') 
														 | 
														
														 | 
														
															 				  ->fields('ft') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				  ->condition('ft.'.$column['tid'], $term->tid); 
														 | 
														
														 | 
														
															 				  ->condition('ft.'.$column['tid'], $term->tid); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				$result = $query->execute(); 
														 | 
														
														 | 
														
															 				$result = $query->execute(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				// $entity = db_query('SELECT * FROM :fieldtabe WHERE :fieldcolumn = %tid', array(':fieldtabe'=>$table, ':fieldcolumn'=>$column['tid'], '%tid'=>$term->tid))->fetchAssoc(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				break; 
														 | 
														
														 | 
														
															 				break; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			// dsm($result, '$result'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			foreach ($result as $entity) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				// dsm($entity, '$entity'); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				$path = 'node/'.$entity->entity_id; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			foreach ($result as $node) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				$new_path = 'node/'.$node->entity_id; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				if( $new_alias = drupal_get_path_alias($new_path, $options['language']->language) ){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					$path = $new_alias; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					$original_path = $new_path; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					$options['alias'] = TRUE; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					$path = $new_path; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				break; 
														 | 
														
														 | 
														
															 				break; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			 
														 | 
														
														 | 
														
															 			 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		} 
														 | 
														
														 | 
														
															 		} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 /** 
														 | 
														
														 | 
														
															 /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * HELPERS  
														 | 
														
														 | 
														
															  * HELPERS  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  */ 
														 | 
														
														 | 
														
															  */ 
														 |