简体   繁体   中英

custom button in Joomla module admin panel

New to Joomla(one month).

I'm trying to create a module that will list events(names and times). I want the module to be populated from the admin panel. For example lets say the module lists would list the following on the front end:

  1. breakfast........ 9:30
  2. lunch.............12:30
  3. dinner............7:30

In the admin panel there will be input text fields for the admin to add/delete the events and a button(s) that will call a js function execute add/delete.

I am using Joomla4 I'm under the impression that all I need to do is tell the manifest file about my button in the configs sections and then write the javascript in the mod_project.php file that will add/delete a field on press. (Perhaps the js needs to go in the tmpl/default.php I'm not entirely sure where to put it) Unfortunately my attempt to add a button in the config file has failed meaning there is no output in the html: current config section of manifest file:

 <fields name="params"> <fieldset name="basic"> <field name="event_name_0" type="text" label="Event Name" filter="event" /> <field name="event_time_0" type="text" label="Event Time" filter="event" /> <button type="submit" id="testBtn" value="Add">Add</button> </fieldset> </fields> </config>

I have to do that yesterday but I have found a solution more simple: I just added a custom field, for my specific category, with the type repeatable and I have written a module to read this specific field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM