CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Button customisation on contribute pages
Pages: [1]

Author Topic: Button customisation on contribute pages  (Read 642 times)

alanski

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 5
  • Cup of tea? Yes please
    • Joomkit
  • CiviCRM version: Version in post
  • CMS version: Joomla
  • MySQL version: 5.0
Button customisation on contribute pages
April 19, 2012, 04:07:29 am
I am thinkign CivicRM is nuts where templating is concerned :)

Doing the 'simplest' thing like changing the form button value to recognise the difference between a member contribution and a donation seems impossibly difficult. I just wana change the button value to reflect the UX/action performed.

Can some explain this code a bit more?
I see we are detecting the portion of the element id name ... but what is location? And what does crmReplace do?


Code: [Select]
{foreach from=$form.buttons item=button key=key name=btns}
    {if $key|substring:0:4 EQ '_qf_'}
        {if $location}
          {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"}
        {else}
          {assign var='html' value=$form.buttons.$key.html}
        {/if}
        <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}"{if $buttonStyle} style="{$buttonStyle}"{/if}>{$html}</span>
    {/if}
{/foreach}

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Button customisation on contribute pages
April 19, 2012, 06:48:21 am
Put {debug} at the top of the template to pop up a smarty debug window which shows all the variable values currently set. Location is usually the id for the location as it applies to contact addresses (contacts can have more than one address).

But what you probably want to do is actually in the corresponding php file where it builds the form, or without hacking you might be able to change it in the buildForm hook (http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmbuildForm)

alanski

  • I post frequently
  • ***
  • Posts: 216
  • Karma: 5
  • Cup of tea? Yes please
    • Joomkit
  • CiviCRM version: Version in post
  • CMS version: Joomla
  • MySQL version: 5.0
Re: Button customisation on contribute pages
April 19, 2012, 07:00:43 am
THanks that a useful read and writing a joomla plugin is easy enough.

But like I said and you have confirmed it - doing the simplest thing like changing the form submit button value is bizarrely difficult - it really shouldn't require PHP/API programming knowledge of CIVI/Joomla - its just plain bad >:(

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Button customisation on contribute pages
April 24, 2012, 07:54:57 am
Yes, in theory, maybe in this case.

You have at least two options other than the php/api option (which runs the risk of being tied to your civi/joomla versions)

1. Use a simple jquery script to modify the label of the button [hackish, but easy and simple to deploy/replicate without version issues]
2. Use the string replace civicrm administrative option [as long as you want to replace all cases].

I used to think the jquery option was too much of a hack, but it really isn't - it's the right tool for local overriding of interface elements where the override isn't mission critical or security-related.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Button customisation on contribute pages

This forum was archived on 2017-11-26.