Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Custom output can be added to the admin product view to expand the system. To add a custom button to the product, please proceed as follows: 

  1. Open the directory "/modules/servers/freenas".
  2. Create the file customconfig.php
  3. Insert following code

    Code Block
    languagephp
    <?php
    
    if (!function_exists('freenas_customButtons')) {
        function freenas_customButtons ($params) {
            return "<a href='clientsservices.php?id={$params['serviceid']}&do=doSomething'>Do Something</a>";
        }
    }


Using the publicly available API class, you can add your own functions to the module, the result would be as example:

Image Added


You can handle GET or POST requests inside of the customconfig.php, e.g.:

Code Block
languagephp
<?php

if ($_GET['do'] === 'doSomething' AND !empty($_SESSION['adminid'])) {
	// do something
}

if (!function_exists('freenas_customButtons')) {
    function freenas_customButtons ($params) {
        return "<a href='clientsservices.php?id={$params['serviceid']}&do=doSomething'>Do Something</a>";
    }
}