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) {
        return;
      } else {
        switch (categoryName) {
          case "Category name": // category name
            buttonText = "Text"; // button text
            break;
          // add more above this line
          default:
            buttonText = i18nTopicLable;
        }
        $("#create-topic .d-button-label").text(buttonText);
      }
    }
  }
});
</script>

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

2 Likes