mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
chore: extract buildSettingComponent
method into a FormGroup
component (#3927)
* chore: extract `buildSettingComponent` method into a `FormGroup` component * chore: typings * feat: move to common
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import app from 'flarum/admin/app';
|
||||
import ItemList from 'flarum/common/utils/ItemList';
|
||||
import generateElementId from 'flarum/admin/utils/generateElementId';
|
||||
import generateElementId from 'flarum/common/utils/generateElementId';
|
||||
import FormModal, { IFormModalAttrs } from 'flarum/common/components/FormModal';
|
||||
|
||||
import Mithril from 'mithril';
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import { extend } from 'flarum/common/extend';
|
||||
import AdminPage from 'flarum/admin/components/AdminPage';
|
||||
import SelectTagsSettingComponent from './components/SelectTagsSettingComponent';
|
||||
import FormGroup from 'flarum/common/components/FormGroup';
|
||||
import type { IFormGroupAttrs } from 'flarum/common/components/FormGroup';
|
||||
|
||||
export default function () {
|
||||
extend(AdminPage.prototype, 'customSettingComponents', function (items) {
|
||||
items.add('flarum-tags.select-tags', (attrs) => {
|
||||
return <SelectTagsSettingComponent {...attrs} settingValue={this.settings[attrs.setting]} />;
|
||||
extend(FormGroup.prototype, 'customFieldComponents', function (items) {
|
||||
items.add('flarum-tags.select-tags', (attrs: IFormGroupAttrs) => {
|
||||
return <SelectTagsSettingComponent {...attrs} settingValue={attrs.bidi} />;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user