I have two radio buttons in my Drupal 7 product form. One for credit card and the other for 'send an invoice'. I'd like to add some text after each option but I don't know how.

In my hook_form_alter module this is what I'm attempting:

['paypal_commerce_payment_paypal_wpp']['#suffix'] = 'text here';

However, this keeps throwing an error:

Warning: strlen() expects parameter 1 to be string, array given in 
drupal_validate_utf8() (line 1599 of 
Notice: Array to string conversion in format_string() (line 1550 of 

And under the two radio options it just says 'Array' next to yet another radio button. Obviously not what I want. I want the text 'text here' to appear right after the 'Credit Card' radio option.

I also tried targeting the 'suffix' with '#field_suffix' to no avail.

Any idea how to make this happen?

1 Answer 1


The issue here could be the type of element $form['commerce_payment']['payment_method']['#options']['paypal_commerce_payment_paypal_wpp'] is.

Is paypal_commerce_payment_paypal_wpp the key of one your options?

Have you tried #description?

  • I think I see what you mean. That element is a String. I guess I want to append some HTML to the string. If I could change what the string says that would work even better. I tried #description but it gave me the same error.
    – Sage
    Commented Feb 17, 2016 at 22:44
  • Changing what the string says would be really easy $form['commerce_payment']['payment_method']['#options']['paypal_commerce_payment_paypal_wpp'] = 'my new string';
    – Chad Payne
    Commented Feb 17, 2016 at 23:33
  • Nevermind you were correct - it worked. Thank you!
    – Sage
    Commented Feb 18, 2016 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.