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.

Properties
PropertyTypeDefaultDescription
hrefstring''URL; wraps button in <a href="..."> when set
aclassstring''Additional CSS class(es) for the <a> element
targetstring''Link target attribute (e.g. '_blank')
linkInnerboolfalsePlace <a> inside <button> rather than wrapping it outside 3.0.184+
Linking

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 tab

linkInner = true places the <a> inside the <button> instead — useful in non-admin contexts where the outside-wrap breaks CSS:

$f->linkInner = true;
Notes
  • InputfieldButton does not submit the form; it is for navigation or JS-driven actions.
  • Default name is 'button' and default value is 'Button'.
  • Source file: wire/modules/Inputfield/InputfieldButton/InputfieldButton.module
API reference: methods, properties, hooks

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the InputfieldButton class also inherits all the methods and properties of: InputfieldSubmit, Inputfield, WireData and Wire.

Show class? Show args? Only hookable?

Properties

NameReturnSummary
InputfieldButton::aclass string Optional class name(s) for <a> element (if href is used).
InputfieldButton::href string URL to link to
InputfieldButton::linkInner bool Place <a> link inside <button> rather than outside? Not admin compatible. 3.0.184+
DEFAULT: false
InputfieldButton::target string Link target

Additional methods and properties

In addition to the methods and properties above, InputfieldButton also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.267

AltStyle によって変換されたページ (->オリジナル) /