Here’s an example to illustrate the problem:
Forum A (www.example-one-language.com) uses only English with language_id 1. In the options.xml, I can define a static option where the admin selects the nodes in which the addon will function. This works well for a single language.
Forum B (www.example-two-languages.com) uses both English (language_id 1) and Spanish (language_id 2).
In this case, I can create two options in the options.xml:
- Select nodes to use addon functions in English.
- Select nodes to use addon functions in Spanish.
Forum C (www.example-many-languages.com) uses English and several other languages.
Here, I would need to create options for each language, such as selecting nodes for English, Spanish, and any other languages the forum uses.
The problem is that I can’t know in advance how many languages a forum will have. Since options.xml is static, I have to define a fixed number of options. What I actually need is a way to dynamically create a selection for each language used in the forum.
What I’m Not Looking For:
I’m not looking for a solution where I dynamically assign values to a single select element that allows admins to choose from different languages, like:
What I need instead is:
- Select nodes for English.
- Select nodes for Spanish.
- Select nodes for the nth language.
Current Workaround:
Right now, I’m using a workaround where admins manually input all the languages and their corresponding nodes in a text area. While this works technically, it places a burden on admins, who need to understand and manually enter language IDs and node IDs.
1|12,15,27
2|14,12
3|4
The Challenge:
The main challenge is finding a way to dynamically generate options in XenForo based on the number of languages in the forum. Each language should have its own selection, and these options should be dynamically created rather than being statically defined in options.xml.