1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Addon Options

Discussion in 'XenForo Development Discussions' started by rivacom, Jun 13, 2014.

  1. rivacom

    rivacom Active Member

    So I'm in the process of learning to turn my scripts into functional Xenforo addons using the helpful tutorials at http://xenforo.com/community/resources/screencast-creating-xenforo-add-on.694/

    I'm on the current step of giving the addon options, the author creates a options to put the addon in various templates. For my example I wanted to have a field to select/ or input a template name. I noticed one of the options is "named templates" so I assumed this was a list of all the templates. Selected it, saved. Option is not there. So I tried a second one, same issue. If I hit edit display order, I can see them in the list, but no way to delete them or change them.

    Is this a bug? I am using 1.3.
     
    Sean Kendle likes this.
  2. Valhalla

    Valhalla Well-Known Member

    I've noticed this too.

    If you're using a Named Template for your edit format, you must specify an option template, or you won't be able to remove that option.

    If you don't specify a named template, the option will (still) save successfully, and you will never be able to update (modify / delete) this option because it won't show in the list of options.
     
    Last edited: Jun 13, 2014
  3. Brogan

    Brogan XenForo Moderator Staff Member

    You can edit it by manually navigating to admin.php?options/edit-option/optionID

    Where optionID is the ID (name) you assigned when you created it.
     
    Valhalla likes this.
  4. rivacom

    rivacom Active Member

    Thanks Brogan, but is there a reason why it's not showing up?
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Because you didn't specify the template.
    For example:
    upload_2014-6-13_18-48-17.png

    Then in that template you would have this:
    HTML:
        <xen:html>
            {xen:raw $editLink}
            <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
        </xen:html>
    Which would then make the edit icon available.
     
    rivacom likes this.
  6. rivacom

    rivacom Active Member

    Thanks again Brogan!
     
  7. Sean Kendle

    Sean Kendle Member

    Seems like that's a logic error in the CP. It should validate for the "Format Parameters" field being blank, and not allow you to save a "Named Template" without a template name.

    Also, there should probably be some sort of instructions on that page. "Format Parameters" can accept so many different things, and that is not detailed anywhere... no Documentation, no hints, nothing. It's pretty frustrating. This seems to be a common theme...
     

Share This Page