ElevatoDigital / dewdrop

Dewdrop makes writing complex WordPress plugins simpler by providing a sensible project layout and developer tools.
Other
11 stars 3 forks source link

Allow Custom Attributes on Input Elements (via View Helper) #76

Open zschuessler opened 8 years ago

zschuessler commented 8 years ago

Use Case

I would like to:

  1. Show a disabled input field on a form, automatically setting the value for the user. The user should still see the value but not be able to edit it.
  2. Set any number of custom HTML5 data attributes on an element.

Issue Current input view helpers, which render individual form elements, do not allow for setting custom attributes on the element.

See: https://github.com/DeltaSystems/dewdrop/blob/196c00161027ecf122fc78ed4b32a9af856896c9/Dewdrop/View/Helper/InputText.php#L107

Proposed Solution Allow users to set attributes as needed. Whether it be data attributes, disabled flag, or otherwise.