What is the best way to add a link to the button?

I’m trying to replace the New Topic button in a particular category to lead to the Wizard questionnaire (that will create the topic automatically).
Current code to rename the button:

<script type="text/discourse-plugin" version="0.8">
const i18nTopicLable = I18n.lookup("topic.create");
api.modifyClass("component:create-topic-button", {
  didInsertElement: function() {
    var button = $(this),
      category = button[0].parentView.get("category"),
      label = button[0].label,
      newTopicLabel = "topic.create",
      buttonText = "";

    if (category) {
      categoryName = category.name;

      if (label != newTopicLabel) {
      } else {
        switch (categoryName) {
          case "Category name": // category name
            buttonText = "Text"; // button text
          // add more above this line
            buttonText = i18nTopicLable;
        $("#create-topic .d-button-label").text(buttonText);

What will be the best way to change the action to link somewhere instead of the composer?

1 Like