Adding Form Buttons to Your Module (Action Bar)
Please note that this is only available in FreePBX 13 and higher.
The FreePBX Action Bar was added in version 13, to allow for consistency throughout FreePBX. To get started adding or modifying your form submission buttons you can follow the steps below:
Add a getActionBar method to you module class
public function getActionBar($request) { $buttons = array(); switch($request['display']) { case 'announcement': $buttons = array( 'delete' => array( 'name' => 'delete', 'id' => 'delete', 'value' => _('Delete'), 'hidden' => '' ), 'reset' => array( 'name' => 'reset', 'id' => 'reset', 'value' => _('Reset'), 'hidden' => '' ), 'submit' => array( 'name' => 'submit', 'id' => 'submit', 'value' => _('Submit'), 'hidden' => '' ) ); //Don't use empty here as 0 will return true which may not always be desired if (!isset($request['extdisplay']) || trim($request['extdisplay']) == '') { unset($buttons['delete']); } break; } return $buttons; }
Add a class to your form
<form class="fpbx-submit" name="editAnnouncement" action="" method="post" onsubmit="return checkAnnouncement(editAnnouncement);">
If you form has a Delete button, add an attribute to your form called "data-fpbx-delete"
<form class="fpbx-submit" name="editAnnouncement" action="" method="post" onsubmit="return checkAnnouncement(editAnnouncement);" data-fpbx-delete="config.php?display=announcement&extdisplay=<?php echo $extdisplay ?>&action=delete">
Remove any buttons that show on your page as this is all handled via FreePBX now.
Note that the module will submit the page as using the action specified, whereas delete uses the data-fpbx-delete attribute.