Create new module
Hi,
I want to create new module which will have fields similar to LinkedIn. For example Education. Your help will be highly appreciated. Please guide me or share some development tutorial videos.
Thanks.
-
-
·
LeonidS
- ·
Hello @supriya ithape !
Here is the main development manual link:
https://una.io/wiki/Introduction#development
It is better to read it carefully from the Code convention till the Creating a language app chapters.
-
·
LeonidS
-
- · supriya ithape
- ·
Thanks,
How to display the form on the page? I have created forms and added fields. So how to display that form in the service block? Hello world! I don't know where to remove this and add the form. Please check the screenshot. Can you please help me?
-
-
·
LeonidS
- ·
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.
-
·
LeonidS
-
- · supriya ithape
- ·
Thank you. I created a form. but in the page showing only text not display fields like textbox and textarea. Can you please help me?
-
Sorry, but without access to the code, it's hard to find what can be wrong.
-
sorted issue. But i have another issue
- after submitting the form getting this error Fatal error: Uncaught Error: Call to undefined method VndTestModule::_isModerator() in/modules/base/general/classes/BxBaseModGeneralFormEntry.php:473
Can anyone please help me?
-
So do you really use the files and classes with the VndTest prefix? This part should be changed from the provided example to your own item.
-
- · supriya ithape
- ·
So do you really use the files and classes with the VndTest prefix?
Yes
-
Plz, share your variant of classes/VndTestModule.php, classes/VndTestConfig.php, and install/config.php files.
-
- · supriya ithape
- ·
Can you please let me know where I can see variant?
-
I mean we need to see how did you change the mentioned files from example.
-
- · supriya ithape
- ·
Please see attached.
-
-
·
LeonidS
- ·
Ok, so in the classes/VndTestModule.php file change the following line:
class VndTestModule extends BxDolModule
to this variant:
class VndTestModule extends BxBaseModGeneralModule
-
·
LeonidS
-
- · supriya ithape
- ·
Worked.. Thank you so much..
-
- · supriya ithape
- ·
How can i remove help from form fields. Please check screenshot. Also how can I get an auto school names list when typing something. Can you please help me?
-
It seems you have some text for the Help parameter of those new fields.
-
- · supriya ithape
- ·
Hi,
how can I get an auto school names list when typing something. Can you please help me?
-
It will require writing some JS code to send the AJAX request for the field and PHP code processing this request for your module.
-
Hi,
There is no text for the Help parameter of new fields. can you please let me know how to remove?
-
- · supriya ithape
- ·
Hi,
There is no text for the Help parameter of new fields. can you please let me know how to remove?
-
- · supriya ithape
- ·
Hi,
I added new block in view profile. I want to add template for that new added block. So can you please help me how to add template?
-
It depends on the way this block was generated. Does it work as part of your own module? If not - could you plz provide us the details?
-
- · supriya ithape
- ·
yes it's part of own module.