How to add a (static) text field (PHP callback) to the ACP options?


Active member
I've followed Creating an Addon. to create an ACP settings page.
However in edit format there is no 'label' or some other kind of (fake) 'option' which just displays text. (in my case it would be some kind of status text, which is taken from a PHP callback)

So how can I make this (the best way)?
I just want to show some information returned by a PHP callback in the ACP options. For this a "fake option" which only shows this information and does not save something (it does not allow user interaction) would be nice.
I've got out I may use an admin template and a renderHtml method for returning this template.
So what is the best way to accomplish this?

It could possibly look like this:
I think you could create a custom admin template that refers to the string variable you want to populate, and use your callback to populate it.

I think you'd need a listener created in order to avtually load that template though.

I'll look to see if I can find some examples.
Thanks. And no I used no listener - to select the PHP callback function as an option is enough.
Filling the template with values in an PHP callback is no problem, but the option template itself is complicated, because it makes much use of the Xen Admin syntax. Especially the option type is controlled by the "<xen:<option>unit".
But finally I found an example in option_template_censorWords where there is also used a custom option template and I saw you can use <xen:controlunit for this:
<xen:controlunit label="{$preparedOption.title}" hint="{$preparedOption.hint}">
    <xen:explain>{xen:raw $preparedOption.explain}</xen:explain>
        <xen:comment>You can put any custom HTML here.</xen:comment>
        <input type="hidden" name="{$listedFieldName}" value="{$preparedOption.option_id}" />
        {xen:raw $editLink}

This finally solves my problem.
Thanks, this is a good help to me, I have to do something similar with an input box that I'd like to replace with a text message based on certain criteria, and this example might help me out.
Top Bottom