Revision 6e9292aa
Added by Assos Assos over 9 years ago
drupal7/sites/all/modules/ds/ds.module | ||
---|---|---|
302 | 302 |
|
303 | 303 |
static $static_fields, $fields_cached = array(); |
304 | 304 |
static $loaded = FALSE; |
305 |
// Load the ds file that handles ds call of hook_ds_fields_info, otherwise it |
|
306 |
// doesn't get loaded |
|
307 |
module_load_include('inc', 'ds', 'ds.ds_fields_info'); |
|
305 | 308 |
|
306 | 309 |
// Get fields from cache. |
307 | 310 |
if (!$loaded) { |
... | ... | |
571 | 574 |
} |
572 | 575 |
} |
573 | 576 |
|
577 |
$disable_css = FALSE; |
|
578 |
if (!empty($layout['settings']['layout_disable_css'])) { |
|
579 |
$disable_css = TRUE; |
|
580 |
} |
|
581 |
|
|
574 | 582 |
// Add path to css file for this layout and disable block regions if necessary. |
575 |
if (isset($layout['css']) && !isset($loaded_css[$layout['path'] . '/' . $layout['layout'] . '.css'])) { |
|
583 |
if (!$disable_css && isset($layout['css']) && !isset($loaded_css[$layout['path'] . '/' . $layout['layout'] . '.css'])) {
|
|
576 | 584 |
// Register css file. |
577 | 585 |
$loaded_css[$layout['path'] . '/' . $layout['layout'] . '.css'] = TRUE; |
578 | 586 |
// Add css file. |
... | ... | |
649 | 657 |
$layout['layout'] = $layout['panels']['theme']; |
650 | 658 |
} |
651 | 659 |
|
660 |
$bundle = strtr($vars['elements']['#bundle'], '-', '_'); |
|
652 | 661 |
$vars['theme_hook_suggestions'][] = $layout['layout']; |
653 | 662 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type']; |
654 | 663 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $vars['elements']['#view_mode']; |
655 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $vars['elements']['#bundle'];
|
|
656 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $vars['elements']['#bundle'] . '_' . $vars['elements']['#view_mode'];
|
|
664 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $bundle;
|
|
665 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $bundle . '_' . $vars['elements']['#view_mode'];
|
|
657 | 666 |
} |
658 | 667 |
|
659 | 668 |
// If the layout has wrapper class lets add it. |
... | ... | |
686 | 695 |
$vars[$region_name . '_classes'] = !empty($layout['settings']['classes'][$region_name]) ? ' ' . implode(' ', $layout['settings']['classes'][$region_name]) : ''; |
687 | 696 |
|
688 | 697 |
// Token support for region classes. |
689 |
if (module_exists('token')) { |
|
698 |
if (module_exists('token') && isset($var[$object])) {
|
|
690 | 699 |
$vars[$region_name . '_classes'] = token_replace($vars[$region_name . '_classes'], array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE)); |
691 | 700 |
} |
692 | 701 |
} |
... | ... | |
705 | 714 |
// Add layout attributes if any. |
706 | 715 |
$vars['layout_attributes'] = ''; |
707 | 716 |
if (!empty($layout['settings']['layout_attributes'])) { |
708 |
$vars['layout_attributes'] .= ' ' . $layout['settings']['layout_attributes']; |
|
717 |
if (isset($vars[$object])) { |
|
718 |
$vars['layout_attributes'] .= ' ' . token_replace($layout['settings']['layout_attributes'], array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE)); |
|
719 |
} |
|
720 |
else { |
|
721 |
$vars['layout_attributes'] .= ' ' . $layout['settings']['layout_attributes']; |
|
722 |
} |
|
709 | 723 |
} |
710 | 724 |
// Merge in other attributes which were passed to the template. |
711 | 725 |
if (!empty($layout['settings']['layout_attributes_merge'])) { |
... | ... | |
718 | 732 |
} |
719 | 733 |
|
720 | 734 |
// Token support for layout classes. |
721 |
if (module_exists('token')) { |
|
735 |
if (module_exists('token') && isset($var[$object])) {
|
|
722 | 736 |
foreach ($vars['classes_array'] as &$class) { |
723 | 737 |
$class = token_replace($class, array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE)); |
724 | 738 |
} |
... | ... | |
789 | 803 |
*/ |
790 | 804 |
function ds_render_code_field($field) { |
791 | 805 |
if (isset($field['properties']['code'])) { |
806 |
$value = $field['properties']['code']['value']; |
|
807 |
// Token support - check on token property so we don't run every single field through token. |
|
808 |
if (isset($field['properties']['use_token']) && $field['properties']['use_token']) { |
|
809 |
$value = token_replace($value, array($field['entity_type'] => $field['entity']), array('clear' => TRUE)); |
|
810 |
} |
|
792 | 811 |
$format = (isset($field['properties']['code']['format'])) ? $field['properties']['code']['format'] : 'plain_text'; |
793 | 812 |
if ($format == 'ds_code' && module_exists('ds_format')) { |
794 |
$value = ds_format_php_eval($field['properties']['code']['value'], $field['entity'], isset($field['build']) ? $field['build'] : array());
|
|
813 |
$value = ds_format_php_eval($value, $field['entity'], isset($field['build']) ? $field['build'] : array());
|
|
795 | 814 |
} |
796 | 815 |
else { |
797 |
$value = check_markup($field['properties']['code']['value'], $format); |
|
798 |
} |
|
799 |
// Token support - check on token property so we don't run every single field through token. |
|
800 |
if (isset($field['properties']['use_token']) && $field['properties']['use_token'] == TRUE) { |
|
801 |
$value = token_replace($value, array($field['entity_type'] => $field['entity']), array('clear' => TRUE)); |
|
816 |
$value = check_markup($value, $format); |
|
802 | 817 |
} |
803 | 818 |
return $value; |
804 | 819 |
} |
... | ... | |
819 | 834 |
// 3) embed a view with the 2 taxonomies as fields. |
820 | 835 |
if (isset($field['formatter_settings']['load_terms']) && $field['formatter_settings']['load_terms']) { |
821 | 836 |
static $terms_loaded = array(); |
822 |
$language = $field['entity']->language; |
|
837 |
if (isset($field['entity']->language)) { |
|
838 |
$language = $field['entity']->language; |
|
839 |
} |
|
840 |
else { |
|
841 |
$language = LANGUAGE_NONE; |
|
842 |
} |
|
823 | 843 |
$instances = field_info_instances($field['entity_type'], $field['bundle']); |
824 | 844 |
foreach ($instances as $key => $instance) { |
825 | 845 |
$info = field_info_field($key); |
... | ... | |
838 | 858 |
// This term is missing in the database. |
839 | 859 |
continue; |
840 | 860 |
} |
841 |
$terms_loaded[$item['tid']]; |
|
861 |
$terms_loaded[$item['tid']] = $term;
|
|
842 | 862 |
} |
843 | 863 |
$field['entity']->{$key}[$language][$tkey]['taxonomy_term'] = $terms_loaded[$item['tid']]; |
844 | 864 |
} |
... | ... | |
870 | 890 |
$content = ''; |
871 | 891 |
if ($show_title) { |
872 | 892 |
if (empty($title_wrapper)) $title_wrapper = 'div'; |
873 |
$content .= '<' . check_plain($title_wrapper) . '>' . $data->title . '</' . check_plain($title_wrapper) . '>'; |
|
893 |
$content .= '<' . check_plain($title_wrapper) . ' class="title">' . $data->title . '</' . check_plain($title_wrapper) . '>';
|
|
874 | 894 |
} |
875 | 895 |
if (is_array($data->content)) { |
876 | 896 |
$content .= drupal_render($data->content); |
... | ... | |
1227 | 1247 |
} |
1228 | 1248 |
else { |
1229 | 1249 |
$term = taxonomy_term_load($item['tid']); |
1250 |
if (module_exists('i18n_taxonomy')) { |
|
1251 |
$term = i18n_taxonomy_localize_terms($term); |
|
1252 |
} |
|
1230 | 1253 |
if (!is_object($term)) { |
1231 | 1254 |
// This term is missing in the database. |
1232 | 1255 |
continue; |
... | ... | |
1259 | 1282 |
} |
1260 | 1283 |
else { |
1261 | 1284 |
$term = taxonomy_term_load($item['tid']); |
1285 |
if (module_exists('i18n_taxonomy')) { |
|
1286 |
$term = i18n_taxonomy_localize_terms($term); |
|
1287 |
} |
|
1262 | 1288 |
if (!is_object($term)) { |
1263 | 1289 |
// This term is missing in the database. |
1264 | 1290 |
continue; |
... | ... | |
1269 | 1295 |
$item_display = check_plain($term->name); |
1270 | 1296 |
if ($linked) { |
1271 | 1297 |
$uri = entity_uri('taxonomy_term', $term); |
1272 |
$item_display = l($term->name, $uri['path']); |
|
1298 |
$item_display = l($term->name, $uri['path'], $uri['options']);
|
|
1273 | 1299 |
} |
1274 | 1300 |
} |
1275 | 1301 |
$terms[] = $item_display; |
Also available in: Unified diff
Weekly update of contrib modules