Index: mobile_codes.filter.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mobile_codes/mobile_codes.filter.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 mobile_codes.filter.inc --- mobile_codes.filter.inc 4 Mar 2009 02:16:30 -0000 1.1.2.3 +++ mobile_codes.filter.inc 23 Mar 2009 01:38:39 -0000 @@ -77,7 +77,7 @@ function mobile_codes_filter_process($te $attr[$attribute[1]] = $attribute[2]; } } - $text = str_replace($match[0], mobile_codes_generate($match[2], $attr, $format), $text); + $text = str_replace($match[0], theme('mobilecode', $match[2], $attr), $text); unset($attr); } } Index: mobile_codes.formatter.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mobile_codes/Attic/mobile_codes.formatter.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 mobile_codes.formatter.inc --- mobile_codes.formatter.inc 4 Mar 2009 02:18:00 -0000 1.1.2.1 +++ mobile_codes.formatter.inc 23 Mar 2009 01:38:39 -0000 @@ -11,8 +11,12 @@ function mobile_codes_field_formatter_in module_load_include('admin.inc', 'mobile_codes'); foreach (mobile_codes_get_presets() as $preset) { - $formatters['mobile_codes_'. $preset->name] = array( - 'label' => t('Mobile code') .': '. $preset->name, + $formatters['mobile_codes_'. $preset->name .'_default'] = array( + 'label' => t('Mobile code: @preset image', array('@preset' => $preset->name)), + 'field types' => array('text') + ); + $formatters['mobile_codes_'. $preset->name .'_path'] = array( + 'label' => t('Mobile code: @preset file path', array('@preset' => $preset->name)), 'field types' => array('text') ); } @@ -21,8 +25,22 @@ function mobile_codes_field_formatter_in } function theme_mobile_codes_formatter($element) { - return theme('mobilecode', $element['#item']['safe'], array( + preg_match('/^mobile_codes_(.*)_(.*)$/', $element['#formatter'], $matches); + + $arguments = array( 'data' => 'text', - 'preset' => drupal_substr($element['#formatter'], 13), - )); + 'preset' => $matches[1] + ); + + switch ($matches[2]) { + case 'path': + $output = mobile_codes_generate($element['#item']['safe'], $arguments); + break; + + default: + $output = theme('mobilecode', $element['#item']['safe'], $arguments); + break; + } + + return $output; } Index: mobile_codes.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mobile_codes/mobile_codes.info,v retrieving revision 1.2.2.2 diff -u -p -r1.2.2.2 mobile_codes.info --- mobile_codes.info 4 Mar 2009 02:16:30 -0000 1.2.2.2 +++ mobile_codes.info 23 Mar 2009 01:38:39 -0000 @@ -3,9 +3,3 @@ name = Mobile Codes description = Create Datamatrix or QR codes via an input filter or a direct call in your template. core = 6.x -; Information added by drupal.org packaging script on 2009-02-26 -version = "6.x-1.x-dev" -core = "6.x" -project = "mobile_codes" -datestamp = "1235650422" - Index: mobile_codes.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mobile_codes/mobile_codes.module,v retrieving revision 1.1.2.6 diff -u -p -r1.1.2.6 mobile_codes.module --- mobile_codes.module 4 Mar 2009 02:16:30 -0000 1.1.2.6 +++ mobile_codes.module 23 Mar 2009 01:38:45 -0000 @@ -90,7 +90,11 @@ function mobile_codes_theme() { module_load_include('admin.inc', 'mobile_codes'); foreach (mobile_codes_get_presets() as $preset) { - $theme['mobile_codes_formatter_mobile_codes_'. $preset->name] = array( + $theme['mobile_codes_formatter_mobile_codes_'. $preset->name .'_default'] = array( + 'arguments' => array('element' => NULL), + 'function' => 'theme_mobile_codes_formatter', + ); + $theme['mobile_codes_formatter_mobile_codes_'. $preset->name .'_path'] = array( 'arguments' => array('element' => NULL), 'function' => 'theme_mobile_codes_formatter', ); @@ -121,7 +125,7 @@ function mobile_codes_load_preset($pid) /** * Generate a mobile code */ -function mobile_codes_generate($data, $arguments = array()) { +function mobile_codes_generate($data, &$arguments = array()) { $values = mobile_codes_process_arguments($arguments); if (($file = mobile_codes_load_mobile_code($data, $arguments)) === FALSE) { @@ -148,7 +152,7 @@ function mobile_codes_generate($data, $a mobile_codes_save_mobile_code($data, $arguments, $file); } - return theme('image', $file, $arguments['name'], $arguments['name'], NULL, FALSE); + return $file; } /** @@ -272,5 +276,7 @@ function mobile_codes_directory_check($d * Theme function for displaying Mobile Codes */ function theme_mobilecode($data, $arguments = array()) { - return mobile_codes_generate($data, $arguments); + $file = mobile_codes_generate($data, $arguments); + + return theme('image', $file, $arguments['name'], $arguments['name'], NULL, FALSE); }