Closed (works as designed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Jun 2011 at 18:36 UTC
Updated:
29 Jul 2014 at 19:39 UTC
Jump to comment: Most recent file
Comments
Comment #1
westbywest commentedSubscribing
Comment #2
drebroff commentedalso met this bug
Comment #3
bfroehle commentedThis should be an easy one to fix -- just a simple one liner would suffice.
Tagging as novice.
Comment #4
bladeduI tried to fix it. It is actually my first commit to Drupal so I hope you don't mind if there are errors.
Comment #5
bladeduSorry I forgot to change the status.
Comment #7
bfroehle commentedBladedu: Great! I'm changing the issue status to "Needs Review". This triggers an automated system test and lets others know that they should review your patch.
Comment #8
bladeduIt failed miserably... I think (but I'm not sure) depends on the patch filename, so I'm commiting it again without spaces.
Comment #10
bladeduOhh god! I'm removing also the # from the filename... I feel like a spammer right now XD.
Comment #11
bladeduHey guys I'm really a n00b! I'm setting the status to need review
Comment #12
bfroehle commentedI think we should probably keep #value in the docstring since it is used, but isn't required (just like #rows, #cols, etc).Edit: I totally misread the patch. However, there is already #value on the line before, so we don't need to add it again.
Powered by Dreditor.
Comment #13
crashtest_ commentedI reviewed this patch, applied it to a clean D8 install, then added the following to the bottom of the page.tpl.php as a means of testing:
This worked, produced a nice textarea, without error. I am not sure how to write a test for this (or anything) having never written one, but this test seems to prove that the patch addresses the issue.
Looks good to me!
Pat
Comment #14
bfroehle commentedCan we fix the docstring as in #12?
Comment #15
bladeduActually my patch adds the #value in the docstring, or am I missing something?
Comment #16
bladeduComment #17
bfroehle commentedOh, I totally misread your patch! Isn't there a #value on the previous line already?
Comment #18
bladeduNo, I added it... the documentation was also wrong.
Comment #19
bfroehle commentedNow there is #value twice.
6 days to next Drupal core point release.
Comment #20
bladeduYou were so right. I recreated the patch keeping the function documentation as is.
Comment #21
attiks commentedLooks good, tested it locally
Comment #22
bassthiam commentedI will check your patch, Bladedu.
I was already working on a patch with the same result, I think.
This is my first ever core patch. Would it be good?
Comment #23
attiks commented@bassthiam, you're patch is exactly the same, so it should be fine. Let's wait for feedback from the testbot and then we can RTBC it again.
Comment #25
bfroehle commentedWow, talk about derailment... I'm reuploading #20 which was marked RTBC in #21.
Comment #26
sunSorry, what's the use-case of a textarea that doesn't go through Form API?
Second, do we really want to make all form element theme functions compatible for rendering elements without Form API? If so, did you test the other elements?
Third, speaking of tests, if this is desired and expected functionality, then it has to be covered by tests.
Lastly, the ternary operator value assignment that assigns the same value if it already exists is a bit unclean. More readable would be:
but since the actual issue is only about preventing a PHP notice, the same can be achieved using:
Comment #27
bfroehle commentedShrug.
Well, the only similar element to test would be theme_textfield which does not throw any error if #value is omitted. In retrospect, I think you are correct that the original author probably didn't understand the form api. Therefore I'm content marking this as won't fix.
Agreed, but it is peppered throughout Drupal already (just try running
find . -type f | xargs egrep "\\\$(.+) = isset\(\\\$\\1\) \\? \\\$\\1 :"). The final$element += array('#value' => '');is of course the cleanest.Comment #28
bfroehle commented