devel/grid_example: add option field to showcase grid %field magic

The form %field magic works here too but let's not complicate an
example controller with it.

PR: https://github.com/opnsense/core/issues/10225
This commit is contained in:
Franco Fichtner 2026-04-28 10:49:59 +00:00
parent 825702e60c
commit 0ae49cfafc
3 changed files with 20 additions and 6 deletions

View file

@ -1,5 +1,6 @@
PLUGIN_NAME= grid_example
PLUGIN_VERSION= 1.1
PLUGIN_REVISION= 1
PLUGIN_COMMENT= A sample framework application
PLUGIN_MAINTAINER= ad@opnsense.org

View file

@ -3,7 +3,7 @@
<id>address.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>Enable this address</help>
<help>Enable this address.</help>
<!-- Format the grid column for enabled button-->
<grid_view>
<width>6em</width>
@ -15,13 +15,19 @@
<id>address.email</id>
<label>Email</label>
<type>text</type>
<help>Enter the email address</help>
<help>Enter the email address.</help>
</field>
<field>
<id>address.schedule</id>
<label>Schedule</label>
<type>dropdown</type>
<help>Select your preferred schedule.</help>
</field>
<field>
<id>address.description</id>
<label>Description</label>
<type>text</type>
<help>Enter an optional description</help>
<help>Enter an optional description.</help>
<!-- Hide this grid column per default -->
<grid_view>
<visible>false</visible>

View file

@ -1,8 +1,6 @@
<model>
<mount>//OPNsense/GridExample</mount>
<description>
the OPNsense "GridExample" application
</description>
<description>OPNsense "GridExample" application</description>
<items>
<addresses>
<address type="ArrayField">
@ -10,6 +8,15 @@
<Default>1</Default>
<Required>Y</Required>
</enabled>
<schedule type="OptionField">
<Default>wly</Default>
<Required>Y</Required>
<OptionValues>
<dly>Daily</dly>
<wly>Weekly</wly>
<mly>Monthly</mly>
</OptionValues>
</schedule>
<email type="EmailField">
<Required>Y</Required>
</email>