Comment to 'Create new module'
  • First, you should have a method with a name like serviceActionThing in your module. The form's code can be taken from the example here: https://una.io/wiki/Dev-Forms#example-of-usage. So it will look like this:

    function serviceActionThing () {

    bx_import('BxDolForm');
    $oForm = BxDolForm::getObjectInstance('sample_form_objects', 'sample_form_objects_add'); // get form instance for specified form object and display
    if (!$oForm)
        die('"sample_form_objects_add" form object or "sample_form_objects_add" display is not defined');
    $oForm->initChecker(); // init form checker witout any data - adding new record
    if ($oForm->isSubmittedAndValid())
        echo 'inserted id: ' . $oForm->insert (); // add new record to the database 
    return $oForm->getCode(); // display form 
    

    }

    And the MySQL code to insert the block which uses this method will be following:

    INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES

    ('bx_persons_home', 1, 'bx_persons', '_[lang key for the title of this block]', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"[name of your module]";s:6:"method";s:13:"action_thing"}', 0, 1, 0);

    The highlighted parts relate to the mentioned things. The s:10 means the string length of the name of your module so the defined number may have another value.