mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 04:33:37 +08:00
9c5fc6f1df
From plugin-api comment: Registers a new tab to be displayed in "more topics" area at the bottom of a topic page. ```gjs api.registerMoreTopicsTab({ id: "other-topics", name: i18n("other_topics.tab"), component: <template>tbd</template>, condition: ({ topic }) => topic.otherTopics?.length > 0, }); ``` You can additionally use more-topics-tabs value transformer to conditionally show/hide specific tabs. ```js api.registerValueTransformer("more-topics-tabs", ({ value, context }) => { if (context.user?.aFeatureFlag) { // Remove "suggested" from the topics page return value.filter( (tab) => context.currentContext !== "topic" || tab.id !== "suggested-topics" ); } }); ``` |
||
---|---|---|
.. | ||
ADMIN-QUICK-START-GUIDE.md | ||
AUTHORS.md | ||
CHANGELOG-JAVASCRIPT-PLUGIN-API.md | ||
code-of-conduct.md | ||
DEVELOPER-ADVANCED.md | ||
DEVELOPMENT-OSX-NATIVE.md | ||
INSTALL-cloud.md | ||
INSTALL-email.md | ||
INSTALL.md | ||
PLUGINS.md | ||
SECURITY.md | ||
TESTING.md | ||
TROUBLESHOOTING.md |