function theme_rate_ui_sprites in Rate 7.2
Theme function for Rate ui sprites.
File
- ui/
rate_ui.module, line 107 - Main module file for the Rate UI module.
Code
function theme_rate_ui_sprites($element) {
if ($element['element']['#imagesource'] == 'spritegenerator') {
$header = array(
t('Kind'),
t('Class'),
);
}
else {
$header = array(
t('Kind'),
t('X'),
t('Y'),
t('Width'),
t('Height'),
);
}
$rows = array();
foreach ($element['element'] as $name => $button) {
if ($name[0] != '#') {
$fields = array();
foreach ($button as $field_name => $field) {
if (preg_match('/^button([0-9]+)_([a-z_]+)_([a-z]+)$/', $field_name, $match)) {
$number = $match[1];
$kind = $match[2];
$field_name = $match[3];
$field['#title'] = '';
$fields[$field_name] = drupal_render($field);
}
}
if ($element['element']['#imagesource'] == 'spritegenerator') {
$rows[] = array(
$button['#title'],
$fields['class'],
);
}
else {
$rows[] = array(
$button['#title'],
$fields['x'],
$fields['y'],
$fields['width'],
$fields['height'],
);
}
}
}
$table_variables = array(
'header' => $header,
'rows' => $rows,
);
return theme('table', $table_variables);
}