Proper More Link
MGParisi - July 7, 2008 - 20:35
| Project: | Birthdays |
| Version: | 5.x-1.1 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | maartenvg |
| Status: | needs review |
Description
please change Line 825 to the site default.
$output .= ''. l(t('More'), 'birthdays') .'';
Thanks.

#1
change 809 to
$output = '';
This gives much needed formatting freedom!
#2
Thisis a .PATCH that includes a heading for the block (which can be set to display:none) and ID's for all of the table values to match that of drupal's standards of "odd" and "even" while also labeling the td tags to include class's for sizing and alignment. The result has been tested fully, but the patch is my first one, so make sure it works right!
Thanks
Mike
#3
Please do not set your own patches at "RTBC". I'll look into it. Changing the 'more' link will be done at a minimum.
Changing the content of the block will be considered, but I don't think it will go into the module. That's what theme_ functions are for.
#4
#5
Commited to 5.x-dev
#6
Automatically closed -- issue fixed for two weeks with no activity.
#7
You did what I asked, but you gave credit to another individual...
- #320218 by BENNYSOFT: Drupal-conform more-link or Birthdays block.
The following code is my birthday module. It ALSO conforms to Drupal's (not mine) table standards. of even and odd classes. This is not simply a change in style. This conforms to the HTML 3.01 standard and XHTML standard. If you don't want this to have the even/odd standard then you should use div tags instead. Since the theme function changed since my patch, the above patch wont work... Adding a id or class to the table is good practice, because without it, using css to style your block is impossible.
function zen_birthdays_block($birthdays, $amount, $delta) {
global $_birthdays_field;
if (!empty($birthdays)) {
$output = '<table id="birthdays">';
$odd=1;
foreach ($birthdays as $b) {
$account = user_load(array('uid' => $b));
$age = _birthdays_show_age($account);
// +1 when the birthday isn't today, because it shows the age the person will be on his/her birthday
$age = isset($age) ? '('. ($account->age + !($account->{$_birthdays_field->name}['day'] == format_date(time(), 'custom', 'j') && $account->{$_birthdays_field->name}['month'] == format_date(time(), 'custom', 'n'))) .')' : '';
$date = _birthdays_show_date($account->{$_birthdays_field->name}, $account);
$account->{$_birthdays_field->name}['year'] = NULL; // Don't show the year in blocks
if ($odd)
{
$tr_class = "odd";
$odd = 0;
}
else
{
$tr_class = "even";
$odd = 1;
}
$output .= '<tr class="'.$tr_class.'"><td class="birthday-name">'. theme('username', $account) .' <small>'. $age .'</small></td><td class="birthday-age">'. $date .'</td></tr>';
}
$output .= '</table>';
}
else {
$output = '<p id="no-birthday">'. t('Nobody is having their birthday soon.') .'</p>';
}
$output .= '<div class="more-link">'. l(t('More'), 'birthdays') .'</div>';
return $output;
}
#8
I am aware that the above code is not in .PATCH format... but the time it took me to create the last .PATCH and the fact that the .PATCH file was ignored was enough for me to avoid creating again. If my work will not be ignored, I will be happy to create a .PATCH file...
Heine on IRC suggested I modify my code to use the theme_table function... the results will be similar, but will utilize current Drupal library functions.
I will do this if you would implement it...
#9
Your code went in before that of BENNYSOFT. Yours was in September, while the latter went in in October. See http://drupal.org/cvs?commit=140325 for your commit, as you can see I even credited you (but I only recently started using commit messages in the changelog.txt, if that's what you mean). BENNYSOFT made some improvements to the code you provided to make it even more Drupal-like, see here #320218: Drupal-conform more-link in Birthdays block.
If you create a patch that slims down the theme_birthdays_block() by using theme_table, I'll be happy to commit that.