5.0 patch
alex_b - January 11, 2007 - 21:49
| Project: | Font size |
| Version: | HEAD |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Thanks for your great module. We are using it on quite a couple of sites.
I patched fontsize to 5.0.
Changes:
- new .info file
- use of drupal_add_css() and drupal_add_js() functions where possible
- path to fontsize CSS is theme function -> configurable
- links have own theme function
- fontsize.css allows for some size-independent theming
| Attachment | Size |
|---|---|
| fontsize-5.0-patch.tar.gz | 2.74 KB |

#1
I have not tested it yet on 5 but I have looked at the patch and it is missing a change that is needed to get from 4.6 to 4.7
href="'. base_path() . drupal_get_path in three places you need to insert base_path()
#2
I patched it and tried it on 5.0. It switches between normal and large sizes fine, and between small and large sizes fine, but not between small and normal sizes at all.
#3
Well you shouldn't need to follow #1 to upgrade from 4.6 to 4.7 because these lines are being removed.
So don't add
base_path()And for #2 is because there is only
normal.cssandlarger.css. So just copy one of those tosmaller.cssand edit it to your needs (something likefont-size: 80%;).You can also see how to patch this file at: http://drupal.org/patch/apply
Or you can download the attachment from me at http://drupal.org/node/132886 where I have already patched the right files and created the
smaller.cssfile.#4
patch works fine in FF. In IE it gives page not found error :(
#5
forget to mention IE's version # - i tested in IE7
#6
As a interims solution, use font size from http://www.yaml-fuer-drupal.de/de/download#fontsize, please. This version will probably replace this project code after i rewrote some of the JS code.
#7
hass, thanks for the code. it works better, but the problem is that in its block instead of words or letter it shows: nullnullnullnullnullnullnullnullnull with three active links.
#8
after uninstalling, cleaning cache and reinstalling everything works perfectly. hass, thank you very much for the code. i think it is ready to be submitted.
#9
It would be very nice, if you could provide detailed instructions in English. I used Google translation and tried to follow what I could get from http://translate.google.com/translate?u=http%3A%2F%2Fwww.yaml-fuer-drupa... Unfortunately, I could not set it up for region. I only can use as a block.
#10
Well - after D6 comes out - 100% for sure :-) - i'm only waiting for this... Online translators are really hell... :-(
It's not difficult. Simply add two pices of code to your page.tpl.php for the regions.
Put this _init placeholder directly after the body element.
...<body>
<?php print $fontsize_init ?>
...
Now add the following placeholder anywhere you want the 3 font size icons displayed.
<?php print $fontsize_links ?>Additional put this into your template.php (This will get much smarter in D6).
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
// Load region content assigned via drupal_set_content().
if (module_exists('fontsize')) {
foreach (array('fontsize_init', 'fontsize_links') as $region) {
$vars[$region] = drupal_get_content($region);
}
}
break;
}
return $vars;
}
?>
#11
strange - yesterday i guess i did almost the same and it did not work. now i copied three pieces of code from here and everything works perfectly. thanks for that hass. but to say frankly, when i first noticed $region variable i thought that the module makes possible to resize font size of a particular region without effecting others. however, its effect is global and last steps were just about how to place 3 font size icons. which could be easily done by putting the following code anywhere:
<?php$block = module_invoke('module_name', 'block', 'view', 0);
print $block['content'];
?>
#12
hass, i am still struggling over how to make it work for only content region without effecting left or right blocks. can you please elaborate on how to do this?
#13
The module cannot resize one region only. You can place it in a region, but it affects global.
#14
oh i see. this would be very good feature, though. i wonder is it possible to maintainers to make it possible to limit the effect of the module only to particular region or inside of particular < div > < /div >? should i open separate feature request or wait until 5.0 version is released? because we are talking about patched upgrade of the module for now, right?
#15
hass, i've run onto another critical issue with the module. the matter is that i use flatforum, which has the exactly the same function declared. Could you please help with making two modules work together. i tried to put together two functions as the following way, but it does not work:
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
// Load region content assigned via drupal_set_content().
if (module_exists('fontsize')) {
foreach (array('fontsize_init', 'fontsize_links') as $region) {
$vars[$region] = drupal_get_content($region);
}
}
break;
}
static $is_forum;
$variables = array();
if (!isset($is_forum)) {
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '') {
$nid = arg(1);
}
if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
$nid = arg(2);
}
if ($nid) {
$node = node_load(array('nid' => $nid));
}
$is_forum = ($node && $node->type == 'forum');
_is_forum($is_forum);
}
if ($is_forum) {
switch ($hook) {
case 'comment' :
$variables['template_file'] = 'node-forum';
$variables['row_class'] = _row_class();
$variables['name'] = $vars['author'];
$variables['userid'] = $vars['comment']->uid;
$joined = module_invoke('flatforum', 'get_created', $vars['comment']->uid);
$variables['joined'] = $joined ? format_date($joined, 'custom', 'Y-m-d') : '';
$posts = module_invoke('flatforum', 'get', $vars['comment']->uid);
$variables['posts'] = $posts ? $posts : 0;
$variables['submitted'] = format_date($vars['comment']->timestamp);
$subject = $vars['comment']->subject;
$variables['title'] = empty($subject) ? ' ' : $subject;
$variables['content'] = $vars['comment']->comment;
$variables['links'] = empty($vars['links']) ? ' ' : $vars['links'];
break;
case 'node' :
$variables['row_class'] = _row_class();
$variables['userid']=$vars['node']->uid;
$joined = module_invoke('flatforum', 'get_created', $vars['node']->uid);
$variables['joined'] = $joined ? format_date($joined, 'custom', 'Y-m-d') : '';
$posts = module_invoke('flatforum', 'get', $vars['node']->uid);
$variables['posts'] = $posts ? $posts : 0;
$variables['title'] = empty($vars['title']) ? ' ' : $vars['title'];
$variables['content'] = $vars['node']->body;
$variables['links'] = empty($vars['links']) ? ' ' : $vars['links'];
break;
}
}
return $variables;
}
function _row_class() {
static $forum_row = TRUE;
$forum_row = !$forum_row;
return $forum_row ? 'odd' : 'even';
}
function _is_forum($arg = NULL) {
static $is_forum = FALSE;
if ($arg) {
$is_forum = $arg;
}
return $is_forum;
}
?>
#16
Some version for 5.x
http://drupal.org/node/132886#comment-231190
#17
see #6 for a link