Bug in accessibility_link Found

I have been doing fairly intensive testing on a mobile device of this site and I have found an issue with the accessibility_link function. The idea of the function was to jump to the second page of the paged content. However this was not happening.

I realized that certain parameters were not getting passed. It also contained obsolete variables from previous versions of Drupal. To this end, I have changed the code to the following. No patch or upgrade has been loaded to CVS yet. This will follow shortly.


<?php 
function accessibility_link($type$node NULL$teaser FALSE) {
  
$links = array();
  global 
$accessibility;
  if (
$type == 'node') {
    if (
array_key_exists('links'$node)) {
      
$links $node->links;
    }
 
    if (
$teaser AND $accessibility['paged'] == TRUE) {
      
$links['node_read_more'] = array(
        
'title' => t('[6] More ..'),
        
'href' => drupal_get_path_alias("node/$node->nid"),
        
'attributes' => array('title' => t('Read more'), 'class' => 'read-more-paging''accesskey' => 6),
        
'query' => 'page=0,1'
      
);
    }
  }
  
  return 
$links;
}


Comments

Call to undefined function drupal_get_path()

Fatal error: Call to undefined function drupal_get_path() in /var/www/modules/accessibility/accessibility.module on line 26

Is there a fix for this?

I'm using the latest verison accessibility-5.x-1.x-dev.tar.gz and have made the modification to common.inc

Any help would be great!!!!

No idea why you are getting this error...

.. and sorry you are having issues.

The changes to common.inc have no bearing on this at all.
The line in the module file is when the module calls a file for inclusion.

If you know the actual path to this file you can remove the function and use the actual path, or as an alternative try writing your own...

if (!function_exists("drupal_get_path")) {
function drupal_get_path($type, $name) {
return dirname(drupal_get_filename($type, $name));
}
}

I assume that you are actually using a Drupal version 5 something. Also search the Drupal site for this error message.

HTH.

Br

Jamie

Unraveling the mysteries of the web
http://www.skiffie.com

Seeing same thing...

complains about missing drupal_get_path() in line 199 of accessibility.module.

If I add the hack that creates that function, I then get an error regarding drupal_set_header() (line 56).

Is there some initialization that needs to be done to find the drupal_* functions?

Found the problem!

Ok, it seems that this happens if you have accessibility installed, but forget (oops!) to enable the wap and mobi themes... does that make sense?

Makes perfect sense

The themes must exist and be enabled -
otherwise the module won't work.

With the releases up to v5 the mobile themes are hard-coded.
I hope to change this with future releases.

Glad you got it sorted though.

Br

Jamie
Making Drupal Mobile

Syndicate content