Révision 3dfa8105
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ds/modules/ds_extras/ds_extras.module | ||
---|---|---|
729 | 729 |
|
730 | 730 |
$config = $variables['ds-config']; |
731 | 731 |
|
732 |
// Set prefix |
|
733 |
if (!empty($config['prefix'])) { |
|
734 |
$output .= $config['prefix']; |
|
735 |
} |
|
736 |
|
|
732 | 737 |
// Render the label if it's not hidden. |
733 | 738 |
if (!$variables['label_hidden']) { |
739 |
$styled_label = $variables['label']; |
|
740 |
if (!isset($config['lb-col'])) $styled_label .= ': '; |
|
741 |
|
|
742 |
// Style the label it self |
|
734 | 743 |
$label_wrapper = isset($config['lb-el']) ? $config['lb-el'] : 'div'; |
735 | 744 |
$class = array('label-' . $variables['element']['#label_display']); |
736 | 745 |
if (!empty($config['lb-cl'])) $class[] = $config['lb-cl']; |
... | ... | |
739 | 748 |
if (!empty($config['lb-at'])) $attributes[] = $config['lb-at']; |
740 | 749 |
if (!empty($config['lb-def-at'])) $attributes[] = $variables['title_attributes']; |
741 | 750 |
$attributes = (!empty($attributes)) ? ' ' . implode(' ', $attributes) : ''; |
742 |
$output .= '<' . $label_wrapper . $class . $attributes . '>' . $variables['label']; |
|
743 |
if (!isset($config['lb-col'])) $output .= ': '; |
|
744 |
$output .= '</' . $label_wrapper . '>'; |
|
751 |
$styled_label = '<' . $label_wrapper . $class . $attributes . '>' . $styled_label . '</' . $label_wrapper . '>'; |
|
752 |
|
|
753 |
// Place it inside a wrapper |
|
754 |
if (isset($config['lbw'])) { |
|
755 |
$class = !empty($config['lbw-cl']) ? ' class="' . $config['lbw-cl'] . '"' : ''; |
|
756 |
$attributes = !empty($config['lbw-at']) ? ' ' . $config['lbw-at'] : ''; |
|
757 |
$styled_label = '<' . $config['lbw-el'] . $class . $attributes . '>' . $styled_label . '</' . $config['lbw-el'] . '>'; |
|
758 |
} |
|
759 |
|
|
760 |
$output .= $styled_label; |
|
745 | 761 |
} |
746 | 762 |
|
747 | 763 |
// Field items wrapper |
748 | 764 |
if (isset($config['fis'])) { |
749 |
$class = (!empty($config['fis-cl'])) ? ' class="' . $config['fis-cl'] . '"' : '';
|
|
765 |
$class = (!empty($config['fis-cl'])) ? ' class="' . token_replace($config['fis-cl'], array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE)) . '"' : '';
|
|
750 | 766 |
$attributes = array(); |
751 |
if (!empty($config['fis-at'])) $attributes[] = $config['fis-at'];
|
|
767 |
if (!empty($config['fis-at'])) $attributes[] = token_replace($config['fis-at'], array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE));;
|
|
752 | 768 |
if (!empty($config['fis-def-at'])) $attributes[] = $variables['content_attributes']; |
753 | 769 |
$attributes = (!empty($attributes)) ? ' ' . implode(' ', $attributes) : ''; |
754 | 770 |
$output .= '<' . $config['fis-el'] . $class . $attributes . '>'; |
... | ... | |
760 | 776 |
if (isset($config['fi'])) { |
761 | 777 |
$class = array(); |
762 | 778 |
if (!empty($config['fi-odd-even'])) { |
763 |
$class[] = $delta % 2 ? 'odd' : 'even';
|
|
779 |
$class[] = $delta % 2 ? 'even' : 'odd';
|
|
764 | 780 |
} |
765 | 781 |
if (!empty($config['fi-cl'])) { |
766 | 782 |
$class[] = $config['fi-cl']; |
767 | 783 |
} |
768 |
$class = !empty($class) ? ' class="'. implode(' ', $class) .'"' : '';
|
|
784 |
$class = !empty($class) ? ' class="'. token_replace(implode(' ', $class), array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE)) .'"' : '';
|
|
769 | 785 |
$attributes = array(); |
770 | 786 |
if (!empty($config['fi-at'])) { |
771 | 787 |
$attributes[] = token_replace($config['fi-at'], array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE)); |
... | ... | |
794 | 810 |
// Outer wrapper. |
795 | 811 |
if (isset($config['ow'])) { |
796 | 812 |
$class = array(); |
797 |
if (!empty($config['ow-cl'])) $class[] = $config['ow-cl'];
|
|
813 |
if (!empty($config['ow-cl'])) $class[] = token_replace($config['ow-cl'], array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE));
|
|
798 | 814 |
if (!empty($config['ow-def-cl'])) $class[] = $variables['classes']; |
799 | 815 |
$class = (!empty($class)) ? ' class="' . implode(' ', $class) . '"' : ''; |
800 | 816 |
$attributes = array(); |
801 |
if (!empty($config['ow-at'])) $attributes[] = $config['ow-at'];
|
|
817 |
if (!empty($config['ow-at'])) $attributes[] = token_replace($config['ow-at'], array($variables['element']['#entity_type'] => $variables['element']['#object']), array('clear' => TRUE));;
|
|
802 | 818 |
if (!empty($config['ow-def-at'])) $attributes[] = $variables['attributes']; |
803 | 819 |
$attributes = (!empty($attributes)) ? ' ' . implode(' ', $attributes) : ''; |
804 | 820 |
$output = '<' . $config['ow-el'] . $class . $attributes . '>' . $output . '</' . $config['ow-el'] . '>'; |
805 | 821 |
} |
806 | 822 |
|
823 |
// Set suffix |
|
824 |
if (!empty($config['suffix'])) { |
|
825 |
$output .= $config['suffix']; |
|
826 |
} |
|
827 |
|
|
807 | 828 |
return $output; |
808 | 829 |
} |
809 | 830 |
|
... | ... | |
850 | 871 |
} |
851 | 872 |
|
852 | 873 |
// Label. |
853 |
if (isset($form_state['values']['fields'][$key]['label']) && $form_state['values']['fields'][$key]['label'] != 'hidden') {
|
|
874 |
if (isset($form_state['values']['fields'][$key]['label'])) { |
|
854 | 875 |
if (!empty($values['lb'])) { |
855 | 876 |
$field_settings[$key]['formatter_settings']['ft']['lb'] = $values['lb']; |
856 | 877 |
} |
... | ... | |
869 | 890 |
if (!(empty($values['lb-col']))) { |
870 | 891 |
$field_settings[$key]['formatter_settings']['ft']['lb-col'] = TRUE; |
871 | 892 |
} |
893 |
|
|
894 |
// label wrapper |
|
895 |
if (!empty($values['lbw'])) { |
|
896 |
$field_settings[$key]['formatter_settings']['ft']['lbw'] = $values['lbw']; |
|
897 |
} |
|
898 |
if (!(empty($values['lbw-el'])) && $function == 'theme_ds_field_expert') { |
|
899 |
$field_settings[$key]['formatter_settings']['ft']['lbw-el'] = check_plain($values['lbw-el']); |
|
900 |
} |
|
901 |
if (!(empty($values['lbw-cl'])) && $function == 'theme_ds_field_expert') { |
|
902 |
$field_settings[$key]['formatter_settings']['ft']['lbw-cl'] = check_plain($values['lbw-cl']); |
|
903 |
} |
|
904 |
if (!(empty($values['lbw-at'])) && $function == 'theme_ds_field_expert') { |
|
905 |
$field_settings[$key]['formatter_settings']['ft']['lbw-at'] = filter_xss($values['lbw-at']); |
|
906 |
} |
|
907 |
} |
|
908 |
|
|
909 |
if (!(empty($values['prefix']))) { |
|
910 |
$field_settings[$key]['formatter_settings']['ft']['prefix'] = $values['prefix']; |
|
911 |
} |
|
912 |
if (!(empty($values['suffix']))) { |
|
913 |
$field_settings[$key]['formatter_settings']['ft']['suffix'] = $values['suffix']; |
|
872 | 914 |
} |
873 | 915 |
|
874 | 916 |
// Custom field configuration. |
Formats disponibles : Unified diff
Weekly update of contrib modules