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

Addon Options

rivacom

Active member
#1
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.
 

Valhalla

Well-known member
#2
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:

Brogan

XenForo moderator
Staff member
#3
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.
 

Brogan

XenForo moderator
Staff member
#5
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.
 
#7
Because you didn't specify the template.
For example:
View attachment 75686

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.
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...