See #1874770: [form API] how to add html value on button [SOLVED] for another guy with exactly the same issue as me.

Basically I am looking to add a submit button to the page with the form API. I am setting the #value to contain an icon and the text I wish it to contain. As the code presently stands it is impossible due to the check_plain() that is hard coded in form.inc (causing any HTML to be escaped).

I propose removing this, in favour of allowing your themers to perform any data sanitisation that may be required.

Simple patch attached.

CommentFileSizeAuthor
bootstrap-remove-check-plain.patch928 byteswiifm

Comments

wiifm’s picture

Title: Remove check_plain() around a submit button's label » Remove check_plain() around a submit button's #value

change title to be more descriptive.

wundo’s picture

Status: Needs review » Fixed

Committed, thanks!

wiifm’s picture

Thanks for that!

For future reference it is nice to attribute the commits to the original author e.g.

git commit -m "Issue #1900786 by wiifm: Fixed Remove check_plain() around a submit button's #value." --author="wiifm <wiifm@358731.no-reply.drupal.org>"

There is a handy greasemonkey script dreditor that can make this entire commit message for you too.

wundo’s picture

Note that I did attributed to you in the commit message.

wiifm’s picture

The commit message is good, but the author of the commit is yourself

http://drupalcode.org/project/bootstrap.git/commit/48a0a60

If the --author="wiifm <wiifm@358731.no-reply.drupal.org>" is added on the end, then it shows up as a commit by me to the repository (and on my user profile for instance) ;) If you want to encourage others to contribute to the theme, this is a good way to help that.

Have a great day

natted’s picture

Hi wiifm,

You raise a good point. I'll try update my process a little. I don't think wundo did so intentionally, the maintainer instructions don't have much clarity on the subject and there are multiple guides on drupal.org each with conflicting information.

To help you get commit recognition, you may want to consider committing your patch locally and then creating the patch as per:

git format-patch LOCAL_COMMIT_ID --stdout > [project_name]-[short-description]-[issue-number]-[comment-number].patch

Replace LOCAL_COMMIT_ID with the id of the commit ( easily seen by typing git log ).

The result is a patch which has your commit message and author information included.

We can then use git am to apply the patch which should retain your original commit and authorship information.

Personally, I'm not sure of the best approach with multiple authors, if you know of a good strategy - let me know.

Cheers.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.