Projet

Général

Profil

Révision 3dfa8105

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ds/ds.module
684 684
      // Add extras classes to the region.
685 685
      if (empty($layout['flexible'])) {
686 686
        $vars[$region_name . '_classes'] = !empty($layout['settings']['classes'][$region_name]) ? ' ' . implode(' ', $layout['settings']['classes'][$region_name]) : '';
687

  
688
        // Token support for region classes.
689
        if (module_exists('token')) {
690
          $vars[$region_name . '_classes'] = token_replace($vars[$region_name . '_classes'], array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE));
691
        }
687 692
      }
688 693
      // Add a wrapper to the region.
689 694
      if (empty($layout['flexible'])) {
......
712 717
      $vars['layout_attributes'] .= ' ' . drupal_attributes($vars['attributes_array']);
713 718
    }
714 719

  
720
    // Token support for layout classes.
721
    if (module_exists('token')) {
722
      foreach ($vars['classes_array'] as &$class) {
723
        $class = token_replace($class, array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE));
724
      }
725
    }
726

  
715 727
    // Add an onclick attribute on the wrapper.
716 728
    if (!empty($layout['settings']['layout_link_attribute'])) {
717 729
      $url = '';
718 730
      switch ($layout['settings']['layout_link_attribute']) {
719 731
        case 'content':
720
          $uri = entity_uri($vars['elements']['#entity_type'], $vars[$object]);
732
          if ($object == 'user') {
733
            $uri = entity_uri($vars['elements']['#entity_type'], $vars['elements']['#account']);
734
          }
735
          else {
736
            $uri = entity_uri($vars['elements']['#entity_type'], $vars[$object]);
737
          }
721 738
          if (!empty($uri)) {
722 739
            $url = $uri['path'];
723 740
          }
......
726 743
          $url = $layout['settings']['layout_link_custom'];
727 744
          break;
728 745
        case 'tokens':
729
          $url = token_replace($layout['settings']['layout_link_custom'], array($vars['elements']['#entity_type'] => $vars[$object]));
746
          $url = token_replace($layout['settings']['layout_link_custom'], array($vars['elements']['#entity_type'] => $vars[$object]), array('clear' => TRUE));
730 747
          break;
731 748
      }
732 749

  
......
737 754

  
738 755
    // Let other modules alter the ds array before creating the region variables.
739 756
    $context = array('entity' => isset($vars[$object]) ? $vars[$object] : (isset($vars['elements']['#' . $object]) ? $vars['elements']['#' . $object] : ''), 'entity_type' => $vars['elements']['#entity_type'], 'bundle' => $vars['elements']['#bundle'], 'view_mode' => $vars['elements']['#view_mode']);
740
    drupal_alter('ds_pre_render', $layout_render_array, $context);
757
    drupal_alter('ds_pre_render', $layout_render_array, $context, $vars);
741 758
    foreach ($layout_render_array as $region_name => $content) {
742 759
      // In case this is a panels layout, add the region to the $content variable.
743 760
      if (isset($layout['module']) && $layout['module'] == 'panels') {
......
816 833
          foreach ($field['entity']->{$key}[$language] as $tkey => $item) {
817 834
            if (isset($item['tid']) && !isset($item['taxonomy_term'])) {
818 835
              if (!isset($terms_loaded[$item['tid']])) {
819
                $terms_loaded[$item['tid']] = taxonomy_term_load($item['tid']);
836
                $term = taxonomy_term_load($item['tid']);
837
                if (!is_object($term)) {
838
                  // This term is missing in the database.
839
                  continue;
840
                }
841
                $terms_loaded[$item['tid']];
820 842
              }
821 843
              $field['entity']->{$key}[$language][$tkey]['taxonomy_term'] = $terms_loaded[$item['tid']];
822 844
            }
......
873 895
  $contextual_links = array();
874 896
  $contextual = module_exists('contextual') && user_access('access contextual links');
875 897
  if ($contextual) {
876
    if (is_array($block['content']) && isset($block['content']['#contextual_links'])) {
898
    if (isset($block['content']) && is_array($block['content']) && isset($block['content']['#contextual_links'])) {
877 899
      $contextual_links = $block['content']['#contextual_links'];
878 900
    }
879 901
  }
......
892 914
    }
893 915

  
894 916
    global $theme_key;
895
    $full_block = db_query("SELECT * FROM {block} WHERE module = :module AND delta = :delta AND theme = :theme", array(':module' => $module, ':delta' => $delta, ':theme' => $theme_key))->fetchObject();
917
    if (module_exists('block')) {
918
      $full_block = db_query("SELECT * FROM {block} WHERE module = :module AND delta = :delta AND theme = :theme", array(':module' => $module, ':delta' => $delta, ':theme' => $theme_key))->fetchObject();
919
    }
896 920
    if (!empty($full_block)) {
897 921
      if ($full_block->title == '<none>') {
898 922
        $block['subject'] = '';
......
955 979
 * Render a field.
956 980
 */
957 981
function ds_render_field($field) {
958

  
959 982
  $title_field = FALSE;
960 983

  
961 984
  $output = '';
......
982 1005

  
983 1006
  // Link.
984 1007
  if ($settings['link']) {
985
    if (isset($field['entity']->uri['path'])) {
986
      $path = $field['entity']->uri['path'];
1008
    if (isset($field['entity']->uri)) {
1009
      $uri_info = $field['entity']->uri;
987 1010
    }
988 1011
    else {
989 1012
      $uri_info = entity_uri($field['entity_type'], $field['entity']);
990
      $path = $uri_info['path'];
991 1013
    }
992
    $output = l($output, $path);
1014
    $output = l($output, $uri_info['path'], $uri_info['options']);
993 1015
    if ($title_field) {
994 1016
      $output = ds_edit_support('title', $output, $field);
995 1017
    }
......
1098 1120
  $picture = ds_return_picture($field['entity']);
1099 1121

  
1100 1122
  if (!empty($picture)) {
1101
    $vars = array();
1102 1123
    $filepath = (isset($picture->uri)) ? $picture->uri : $picture;
1103
    $name = !empty($field['entity']->name) ? $field['entity']->name : variable_get('anonymous', t('Anonymous'));
1124
    $name = format_username($field['entity']);
1104 1125
    $alt = t("@user's picture", array('@user' => $name));
1105 1126
    $vars = array('path' => $filepath, 'alt' => $alt, 'title' => $alt);
1106 1127

  
......
1157 1178
      'label'       => t('Rendered taxonomy term'),
1158 1179
      'description' => t('Display the referenced term in a specific view mode'),
1159 1180
      'field types' => array('taxonomy_term_reference'),
1160
      'settings'    => array('taxonomy_term_reference_view_mode' => 'full'),
1181
      'settings'    => array(
1182
        'taxonomy_term_reference_view_mode' => 'full',
1183
        'use_content_language' => TRUE,
1184
      ),
1161 1185
    );
1162 1186
    $formatters['ds_taxonomy_separator'] = array(
1163 1187
      'label'       => t('Separated'),
......
1203 1227
      }
1204 1228
      else {
1205 1229
        $term = taxonomy_term_load($item['tid']);
1230
        if (!is_object($term)) {
1231
          // This term is missing in the database.
1232
          continue;
1233
        }
1234
        $settings = $display['settings'];
1235
        if ($settings['use_content_language'] && !empty($GLOBALS['language_content']->language)) {
1236
          $langcode = $GLOBALS['language_content']->language;
1237
        }
1206 1238
        if (!empty($term)) {
1207 1239
          $build = taxonomy_term_view($term, $view_mode, $langcode);
1208 1240
        }
......
1227 1259
      }
1228 1260
      else {
1229 1261
        $term = taxonomy_term_load($item['tid']);
1262
        if (!is_object($term)) {
1263
          // This term is missing in the database.
1264
          continue;
1265
        }
1230 1266
        if ($display['type'] == 'ds_taxonomy_separator_localized' && function_exists('i18n_taxonomy_term_name')) {
1231 1267
          $term->name = i18n_taxonomy_term_name($term, $language->language);
1232 1268
        }

Formats disponibles : Unified diff