Justoverclock I don't quite understand the question.
- Are you trying to generate a dropdown inside of a custom page or custom content that displays a discussion?
- Are you trying to modify the content of the dropdown on the discussion list / homepage?
- Are you trying to programmatically open the existing dropdown without user interaction?
If you want to create a dropdown with all native actions + actions added by extensions, you can obtain an ItemList of all buttons by calling importing and calling DiscussionControls.controls(discussion, context)
, where context
is usually an instance of the component you are calling the method from, to allow extensions greater flexibility.
You can also use the underlying methods like userControls
, moderationControls
and destructiveControls
to only get a subset of the buttons flarum/frameworkblob/v1.8.8/framework/core/js/src/forum/utils/DiscussionControls.js
To render a dropdown with that code inside, you can take a look directly at the source code of DiscussionListItem
flarum/frameworkblob/v1.8.8/framework/core/js/src/forum/components/DiscussionListItem.tsx#L71-L99 (it's split across 2 methods but you can retrieve the controls
at the same place you are returning the Dropdown
. Flarum core uses more method to make extensibility easier.