new Link(options) → {Class}
A link component .
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the component. Properties
|
- Since
- 1.1.16
- Source
The class instance.
- Type:
- Class
import Link from '@gravityforms/components/html/admin/elements/Link';
function Example() {
const linkInstance = new Link( {
id: 'example-link',
renderOnInit: false,
target: '#example-target',
targetPosition: 'beforeend',
theme: 'cosmos',
} );
// Some time later we can render it. This is only done if we set renderOnInit to false.
// If true it will render on initialization.
linkInstance.init();
}
Methods
(static) init() → {void}
Initialize the component.
- Since
- 1.1.16
- Source
- Type:
- void
(static) linkTemplate(options) → {string}
Generates the markup for a link in the admin.
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the component template. Properties
|
- Since
- 1.1.16
- Source
- Type:
- string
import { linkTemplate } from '@gravityforms/components/html/admin/elements/Link';
function Example() {
const linkTemplateHTML = linkTemplateTemplate( options );
document.body.insertAdjacentHTML( 'beforeend', linkTemplateHTML );
}
(static) render() → {void}
Renders the component into the dom.
- Since
- 1.1.16
- Source
- Type:
- void