Posted by pebosi on November 10, 2008 at 10:30am
Jump to:
| Project: | lm_paypal |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
How to set a custom url to an alternate subscribe button? ( = http://www.paypal.com/de_DE/i/btn/x-click-but20.gif)
regards
Comments
#1
You want to change the graphic? This probably falls into #328023: Change all the output blocks so they can be themed more easily. There is currently no capability to do this in the UI, but you may be able to do it in a third-party module (hook_form_alter) or in your custom theme (theming the LM Paypal Subscriptions block). The low-level function in the code actually has the ability to use custom graphics for the button (third parameter to function lm_paypal_subscribe()).
#2
<?phpif (isset($button_url) && $button_url) {
// TODO button as url
$form['submit'] = array(
'#type' => 'submit',
'#value' => $button_text,
'#name' => 'submit',
);
}
else {
$form['submit'] = array(
'#type' => 'submit',
'#value' => $button_text,
'#name' => 'submit',
);
}
?>
AHAH ! :)
Seriously, we have to find a way to tell Drupal's theme or form API that we want a "custom" button.
#3
I finally found how to tell Drupal to put an image submit button YaY!
It was pretty simple, I just wasn't looking at the right place!
I quickly do a simple administration setting to let the user put an external button url and commit it!<?phpif (isset($button_url) && $button_url) {
$form['submit'] = array(
'#type' => 'image_button',
'#value' => $button_text,
'#attributes' => array('src' => $button_url),
'#name' => 'submit',
);
}
else {
$form['submit'] = array(
'#type' => 'submit',
'#value' => $button_text,
'#name' => 'submit',
);
}
?>
The only thing to do is *DO NOT* use the form "image_button" element "#src" attribute, else it will just add a "/" before (or whatever your $path is).
This method can be used in any hook_form_alter(), even in [theme]_[form_id]_preprocess() hook.
#4
I just checked ecommerce, and they have paypal buttons in their CVS
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/ecommerce/e...
The (default) buttons we'd want are at
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=develo...
I couldn't find a reference that said definitively that we were allowed to copy these to our site....
#5
Not just theming, but also a default block that can take a custom image and DEFINEs for the default PP buttons.