Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/taxonomy/taxonomy.module | ||
---|---|---|
776 | 776 |
* An array in the format expected by drupal_render(). |
777 | 777 |
*/ |
778 | 778 |
function taxonomy_term_view_multiple($terms, $view_mode = 'teaser', $weight = 0, $langcode = NULL) { |
779 |
field_attach_prepare_view('taxonomy_term', $terms, $view_mode, $langcode); |
|
780 |
entity_prepare_view('taxonomy_term', $terms, $langcode); |
|
781 | 779 |
$build = array(); |
780 |
$entities_by_view_mode = entity_view_mode_prepare('taxonomy_term', $terms, $view_mode, $langcode); |
|
781 |
foreach ($entities_by_view_mode as $entity_view_mode => $entities) { |
|
782 |
field_attach_prepare_view('taxonomy_term', $entities, $entity_view_mode, $langcode); |
|
783 |
entity_prepare_view('taxonomy_term', $entities, $langcode); |
|
784 |
|
|
785 |
foreach ($entities as $entity) { |
|
786 |
$build['taxonomy_terms'][$entity->tid] = taxonomy_term_view($entity, $entity_view_mode, $langcode); |
|
787 |
} |
|
788 |
} |
|
789 |
|
|
782 | 790 |
foreach ($terms as $term) { |
783 |
$build['taxonomy_terms'][$term->tid] = taxonomy_term_view($term, $view_mode, $langcode); |
|
784 | 791 |
$build['taxonomy_terms'][$term->tid]['#weight'] = $weight; |
785 | 792 |
$weight++; |
786 | 793 |
} |
794 |
// Sort here, to preserve the input order of the entities that were passed to |
|
795 |
// this function. |
|
796 |
uasort($build['taxonomy_terms'], 'element_sort'); |
|
787 | 797 |
$build['taxonomy_terms']['#sorted'] = TRUE; |
798 |
|
|
788 | 799 |
return $build; |
789 | 800 |
} |
790 | 801 |
|
... | ... | |
817 | 828 |
$term->content = array(); |
818 | 829 |
|
819 | 830 |
// Allow modules to change the view mode. |
820 |
$context = array( |
|
821 |
'entity_type' => 'taxonomy_term', |
|
822 |
'entity' => $term, |
|
823 |
'langcode' => $langcode, |
|
824 |
); |
|
825 |
drupal_alter('entity_view_mode', $view_mode, $context); |
|
831 |
$view_mode = key(entity_view_mode_prepare('taxonomy_term', array($term->tid => $term), $view_mode, $langcode)); |
|
826 | 832 |
|
827 | 833 |
// Add the term description if the term has one and it is visible. |
828 | 834 |
$type = 'taxonomy_term'; |
Formats disponibles : Unified diff
Udpate to 7.33