We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39798
    • 8 Posts
    I'm following the documentation at http://rtfm.modx.com/display/revolution20/Adding+a+Custom+TV+Type+-+MODX+2.2 to create a custom template variable. This doc gets me to the point where I have a functioning TV where I can control how it is input and output, everything I really need. The last piece of the puzzle for me is to get a user-friendly name to display in the combo box of the "Input Options" tab when editing a template variable.

    Finally I was able to get a friendly name by adding a call to addLexiconTopic in the plugin:

    case 'OnTVInputRenderList':
      $modx->controller->addLexiconTopic('mycmp:default');
      $modx->event->output($corePath.'tv/input/');
    


    Where there is an entry for "mytv" in this lexicon topic that is assigned my friendly name. I feel like there should be a different way to do this, specifically something like overriding the modTemplateVarInputRender::getLexiconTopics() function in the file "mytv.class.php" and returning the same lexicon topic.

    Is this the way this should be done? Is this functionality not really completed yet? Any ideas?
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      It sounds to me like you have managed to make it work, right?

      I think using addLexiconTopic is the way to go, as that will then register your topic in the controller - the bit that needs it. The input render class is used for displaying it in resource/update screens, so a different controller that works slightly differently. I've not done much with custom TVs myself yet, but that looks like the way it should be to me.

      If you can think of a better way to do it, be sure to add a proposal to the tracker: http://tracker.modx.com
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 39798
        • 8 Posts
        I guess that makes sense as far as controller vs. render class. No, I can't really think of any other way it should be done, I was just looking for validation mostly smiley. Thanks.