Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Motivation
A new FAPI attribute was added for HTML5's placeholder attribute in #1174694: Allow FAPI usage of the placeholder attribute. Documentation needs to be added to the FAPI doc page for Drupal 8.
Remaining tasks
- Add row to the Form Controls table
- Add to the properties list for each element it is enabled for
- Add a listing in properties
Comment | File | Size | Author |
---|---|---|---|
#6 | 1312016-fapi-placeholder-6.patch | 5.95 KB | linclark |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI will work on creating the HTML that needs to be added to the page, then someone with privileges to update the FAPI page can just add it.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedRow for form controls table:
Comment #2.0
Anonymous (not verified) CreditAttribution: Anonymous commentedRemoved Special Elements task.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedElements
Add the #placeholder element to the list of properties for each element.
#password:
Properties: #access, #after_build, #ajax, #attributes, #description, #disabled, #element_validate, #field_prefix, #field_suffix, #maxlength (default: 128), #parents, #placeholder, #post_render, #prefix, #pre_render, #process, #required, #size (default: 60), #states, #suffix, #theme, #theme_wrappers, #title, #title_display, #tree, #type, #weight
#textarea
Properties: #access, #after_build, #ajax, #attributes, #cols (default: 60), #default_value, #description, #disabled, #element_validate, #field_prefix, #field_suffix, #parents, #placeholder, #post_render, #prefix, #pre_render, #process, #required, #resizable (default: TRUE), #rows (default: 5), #states, #suffix, #theme, #theme_wrappers, #title, #title_display, #tree, #type, #weight
#textfield
Properties: #access, #after_build, #ajax, #attributes, #autocomplete_path (default: FALSE), #default_value, #description, #disabled, #element_validate, #field_prefix, #field_suffix, #maxlength (default: 128), #parents, #placeholder, #post_render, #prefix, #pre_render, #process, #required, #size (default: 60), #states, #suffix, #text_format, #theme, #theme_wrappers, #title, #title_display, #tree, #type, #weight
<p><strong>Properties</strong>: <a href="#access">#access</a>, <a href="#after_build">#after_build</a>, <a href="#ajax">#ajax</a>, <a href="#attributes">#attributes</a>, <a href="#autocomplete_path">#autocomplete_path</a> (default: FALSE), <a href="#default_value"><strong>#default_value</strong></a>, <a href="#description">#description</a>, <a href="#disabled">#disabled</a>, <a href="#element_validate">#element_validate</a>, <a href="#field_prefix">#field_prefix</a>, <a href="#field_suffix">#field_suffix</a>, <a href="#maxlength"><strong>#maxlength</strong></a> (default: 128), <a href="#parents">#parents</a>, <a href="#placeholder">#placeholder</a>, <a href="#post_render">#post_render</a>, <a href="#prefix">#prefix</a>, <a href="#pre_render">#pre_render</a>, <a href="#process">#process</a>, <a href="#required">#required</a>, <a href="#size"><strong>#size</strong></a> (default: 60), <a href="#states">#states</a>, <a href="#suffix">#suffix</a>, <a href="#text_format">#text_format</a>, <a href="#theme">#theme</a>, <a href="#theme_wrappers">#theme_wrappers</a>, <a href="#title"><strong>#title</strong></a>, <a href="#title_display">#title_display</a>, <a href="#tree">#tree</a>, <a href="#type"><strong>#type</strong></a>, <a href="#weightval">#weight</a></p>
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commented#placeholder
Used by: password, textarea, textfield
Description: Defines a short prompt or example text to be displayed in an input field using HTML5's placeholder attribute.
Values: Text, enclosed in the t() translation function.
Usage example:
Make sure to replace the
<
in the code tag when placing the html below.Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedThese are ready to be placed in the FAPI documentation.
Comment #5.0
Anonymous (not verified) CreditAttribution: Anonymous commentedAdded properties task.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedOk, someone pointed me to the fact that we can actually write patches for FAPI, so here we go :)
Comment #7
jn2 CreditAttribution: jn2 commentedPatch is applied. Thanks for the patch, linclark. Makes it much easier to update.
I expect there to be a lot more of these. One thing to look out for if you do another one is the td tag's
class="x"
in the table. It only applies to cells with the X, and in your patch, it was in every cell. I deleted the unnecessary ones. Not sure it really affects how it looks with the current CSS, but it might in the future.Comment #8
jn2 CreditAttribution: jn2 commentedThe last patch had some HTML errors, and now there's a gray background on the whole page that shouldn't be there. Trying to fix.
Comment #9
jn2 CreditAttribution: jn2 commentedThat fixed it.
Comment #10.0
(not verified) CreditAttribution: commentedAdded version.