InputfieldButton
Non-submitting button that can optionally render as a hyperlink
Extends
[[InputfieldSubmit]] — all submit-button properties (value, html, text, icon,
header, secondary, small, showInHeader(), setSecondary(), setSmall(),
dropdown actions, etc.) are inherited and documented there.
Renders <button type="button"> (not a submit button). When href is set, the button
is wrapped in an <a> tag.
$f = $modules->get('InputfieldButton');
$f->value = 'View Page';
$f->href = $page->url;
$form->add($f); See [[Inputfield]] for the shared Inputfield API.
| Property | Type | Default | Description |
|---|---|---|---|
href | string | '' | URL; wraps button in <a href="..."> when set |
aclass | string | '' | Additional CSS class(es) for the <a> element |
target | string | '' | Link target attribute (e.g. '_blank') |
linkInner | bool | false | Place <a> inside <button> rather than wrapping it outside 3.0.184+ |
When href is set, the button is wrapped in an <a> tag by default:
$f->href = '/admin/page/edit/?id=1234';
$f->aclass = 'pw-modal'; // open in a ProcessWire modal
$f->target = '_blank'; // open in new tablinkInner = true places the <a> inside the <button> instead — useful in
non-admin contexts where the outside-wrap breaks CSS:
$f->linkInner = true;Inputfielddoes not submit the form; it is for navigation or JS-driven actions.Button - Default
nameis'button'and defaultvalueis'Button'. - Source file:
wire/modules/Inputfield/InputfieldButton/Inputfield Button.module
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Inputfield class also inherits all the methods and properties of: InputfieldSubmit, Inputfield, WireData and Wire.
Common
| Name | Return | Summary | |
|---|---|---|---|
Inputfield Inputfield Inputfield | None |
Properties
| Name | Return | Summary | |
|---|---|---|---|
| Inputfield | string | Optional class name(s) for <a> element (if href is used). | |
| Inputfield | string | URL to link to | |
| Inputfield | bool | Place <a> link inside <button> rather than outside? Not admin compatible. 3.0.184+ DEFAULT: false | |
| Inputfield | string | Link target |
Additional methods and properties
In addition to the methods and properties above, Inputfield
API reference based on ProcessWire core version 3.0.267