Przeglądaj źródła

with title module : empty entity_label fixed

http://drupal.org/node/1402000
Signed-off-by: bachy <git@g-u-i.net>
bachy 11 lat temu
rodzic
commit
0600bf6674
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      term_reference_tree.widget.inc

+ 6 - 3
term_reference_tree.widget.inc

@@ -312,7 +312,6 @@ function term_reference_tree_process_checkbox_tree($element, $form_state) {
 
     if (empty($element['#options'])) {
       $element['#options_tree'] = _term_reference_tree_get_term_hierarchy($element['#parent_tid'], $element['#vocabulary'], $allowed, $element['#filter_view'], '', $value);
-      
       $required = $element['#required'];
       if ($element['#max_choices'] == 1 && !$required) {
         array_unshift($element['#options_tree'], (object) array(
@@ -463,6 +462,7 @@ function theme_checkbox_tree_item($variables) {
  * This function prints a label that cannot be selected.
  */
 function theme_checkbox_tree_label($variables) {
+  // dsm($variables, 'variables');
   $element = $variables['element'];
   $output = "<div class='parent-term'>" . $element['#value'] . "</div>";
   return $output;
@@ -766,8 +766,11 @@ function _term_reference_tree_build_item(&$element, &$term, &$form_state, &$valu
 
   $t = null;
   if(module_exists('locale')) {
-    $t = taxonomy_term_load($term->tid);
-    $term_name = entity_label('taxonomy_term', $t);
+    // $t = taxonomy_term_load($term->tid);
+    // taxonomy_term_load return term without name, because of module title
+    $term_name = entity_label('taxonomy_term', $term);
+    // there is a problem here with title module, title_entity_label() return empty label
+    // see http://drupal.org/node/1764354
   } else {
     $term_name = $term->name;
   }