Reference Source
import AdminPage from 'flarum/admin/components/AdminPage'
public class | source

AdminPage

Extends:

src/common/components/Page.js~Page → AdminPage

Valid options for the setting component builder to generate a Switch.

Member Summary

Public Members
public

loading: *

public

Method Summary

Public Methods
public

buildSettingComponent(entry: *): *

buildSettingComponent takes a settings object and turns it into a component.

public

dirty(): *

Returns a map of settings keys to values which includes only those which have been modified but not yet saved.

public

header(vnode: *): *

Returns the Header component for this AdminPage.

public

headerInfo(): {"className": *, "icon": *, "title": *, "description": *}

Returns the options passed to the AdminHeader component.

public

isChanged(): *

Returns the number of settings that have been modified.

public

Called when saveSettings completes successfully.

public

saveSettings(e: *): *

Saves the modified settings to the database.

public

setting(key: *, fallback: string): *

Returns a function that fetches the setting from the app global.

public

submitButton(vnode: *): *

Returns the submit button for this AdminPage.

public

view(vnode: *): *

Public Members

public loading: * source

public settings: * source

Public Methods

public buildSettingComponent(entry: *): * source

buildSettingComponent takes a settings object and turns it into a component. Depending on the type of input, you can set the type to 'bool', 'select', or any standard <input> type. Any values inside the 'extra' object will be added to the component as an attribute.

Alternatively, you can pass a callback that will be executed in ExtensionPage's context to include custom JSX elements.

Params:

NameTypeAttributeDescription
entry *

Return:

*

Example:


{
   setting: 'acme.checkbox',
   label: app.translator.trans('acme.admin.setting_label'),
   type: 'bool',
   help: app.translator.trans('acme.admin.setting_help'),
   className: 'Setting-item'
}

{
   setting: 'acme.select',
   label: app.translator.trans('acme.admin.setting_label'),
   type: 'select',
   options: {
     'option1': 'Option 1 label',
     'option2': 'Option 2 label',
   },
   default: 'option1',
}

() => {
  return <p>My cool component</p>;
}

public dirty(): * source

Returns a map of settings keys to values which includes only those which have been modified but not yet saved.

Return:

*

public header(vnode: *): * source

Returns the Header component for this AdminPage.

Params:

NameTypeAttributeDescription
vnode *

Return:

*

public headerInfo(): {"className": *, "icon": *, "title": *, "description": *} source

Returns the options passed to the AdminHeader component.

Return:

{"className": *, "icon": *, "title": *, "description": *}

public isChanged(): * source

Returns the number of settings that have been modified.

Return:

*

public onsaved() source

Called when saveSettings completes successfully.

public saveSettings(e: *): * source

Saves the modified settings to the database.

Params:

NameTypeAttributeDescription
e *

Return:

*

public setting(key: *, fallback: string): * source

Returns a function that fetches the setting from the app global.

Params:

NameTypeAttributeDescription
key *
fallback string
  • optional
  • default:

Return:

*

public submitButton(vnode: *): * source

Returns the submit button for this AdminPage.

Calls this.saveSettings when the button is clicked.

Params:

NameTypeAttributeDescription
vnode *

Return:

*

public view(vnode: *): * source

Params:

NameTypeAttributeDescription
vnode *

Return:

*