Révision cd5c298a
Ajouté par Geoffroy Desvernay il y a environ 5 ans
drupal7/includes/theme.inc | ||
---|---|---|
1776 | 1776 |
* http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. |
1777 | 1777 |
*/ |
1778 | 1778 |
function theme_links($variables) { |
1779 |
$links = $variables['links']; |
|
1780 |
$attributes = $variables['attributes']; |
|
1779 |
$links = (array) $variables['links'];
|
|
1780 |
$attributes = (array) $variables['attributes'];
|
|
1781 | 1781 |
$heading = $variables['heading']; |
1782 | 1782 |
global $language_url; |
1783 | 1783 |
$output = ''; |
1784 | 1784 |
|
1785 |
if (count($links) > 0) {
|
|
1785 |
if (!empty($links)) {
|
|
1786 | 1786 |
// Treat the heading first if it is present to prepend it to the |
1787 | 1787 |
// list of links. |
1788 | 1788 |
if (!empty($heading)) { |
... | ... | |
1995 | 1995 |
$empty = $variables['empty']; |
1996 | 1996 |
|
1997 | 1997 |
// Add sticky headers, if applicable. |
1998 |
if (count($header) && $sticky) {
|
|
1998 |
if (!empty($header) && $sticky) {
|
|
1999 | 1999 |
drupal_add_js('misc/tableheader.js'); |
2000 | 2000 |
// Add 'sticky-enabled' class to the table to identify it for JS. |
2001 | 2001 |
// This is needed to target tables constructed by this function. |
... | ... | |
2009 | 2009 |
} |
2010 | 2010 |
|
2011 | 2011 |
// Format the table columns: |
2012 |
if (count($colgroups)) {
|
|
2012 |
if (!empty($colgroups)) {
|
|
2013 | 2013 |
foreach ($colgroups as $number => $colgroup) { |
2014 | 2014 |
$attributes = array(); |
2015 | 2015 |
|
... | ... | |
2044 | 2044 |
} |
2045 | 2045 |
|
2046 | 2046 |
// Add the 'empty' row message if available. |
2047 |
if (!count($rows) && $empty) {
|
|
2047 |
if (empty($rows) && $empty) {
|
|
2048 | 2048 |
$header_count = 0; |
2049 |
foreach ($header as $header_cell) { |
|
2050 |
if (is_array($header_cell)) { |
|
2051 |
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1; |
|
2052 |
} |
|
2053 |
else { |
|
2054 |
$header_count++; |
|
2049 |
if (!empty($header)) { |
|
2050 |
foreach ($header as $header_cell) { |
|
2051 |
if (is_array($header_cell)) { |
|
2052 |
$header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1; |
|
2053 |
} |
|
2054 |
else { |
|
2055 |
$header_count++; |
|
2056 |
} |
|
2055 | 2057 |
} |
2056 | 2058 |
} |
2057 | 2059 |
$rows[] = array(array('data' => $empty, 'colspan' => $header_count, 'class' => array('empty', 'message'))); |
2058 | 2060 |
} |
2059 | 2061 |
|
2060 | 2062 |
// Format the table header: |
2061 |
if (count($header)) {
|
|
2063 |
if (!empty($header)) {
|
|
2062 | 2064 |
$ts = tablesort_init($header); |
2063 | 2065 |
// HTML requires that the thead tag has tr tags in it followed by tbody |
2064 | 2066 |
// tags. Using ternary operator to check and see if we have any rows. |
2065 |
$output .= (count($rows) ? ' <thead><tr>' : ' <tr>');
|
|
2067 |
$output .= (!empty($rows) ? ' <thead><tr>' : ' <tr>');
|
|
2066 | 2068 |
foreach ($header as $cell) { |
2067 | 2069 |
$cell = tablesort_header($cell, $header, $ts); |
2068 | 2070 |
$output .= _theme_table_cell($cell, TRUE); |
2069 | 2071 |
} |
2070 | 2072 |
// Using ternary operator to close the tags based on whether or not there are rows |
2071 |
$output .= (count($rows) ? " </tr></thead>\n" : "</tr>\n");
|
|
2073 |
$output .= (!empty($rows) ? " </tr></thead>\n" : "</tr>\n");
|
|
2072 | 2074 |
} |
2073 | 2075 |
else { |
2074 | 2076 |
$ts = array(); |
2075 | 2077 |
} |
2076 | 2078 |
|
2077 | 2079 |
// Format the table rows: |
2078 |
if (count($rows)) {
|
|
2080 |
if (!empty($rows)) {
|
|
2079 | 2081 |
$output .= "<tbody>\n"; |
2080 | 2082 |
$flip = array('even' => 'odd', 'odd' => 'even'); |
2081 | 2083 |
$class = 'even'; |
... | ... | |
2095 | 2097 |
$attributes = array(); |
2096 | 2098 |
$no_striping = FALSE; |
2097 | 2099 |
} |
2098 |
if (count($cells)) {
|
|
2100 |
if (!empty($cells)) {
|
|
2099 | 2101 |
// Add odd/even class |
2100 | 2102 |
if (!$no_striping) { |
2101 | 2103 |
$class = $flip[$class]; |
Formats disponibles : Unified diff
MAJ 7.60 -> 7.62