Site Tools

Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)

Procedure to create a new block

Step-1 :

Create a new folder (new_folder) under sites/all/modules/core/<package_name>/<learner/admin package_name>/modules. Create file in the same folder which contains information about what new module does.
Example : 

Step-2 :

Create new_folder.module file in the same folder (new_folder) to write business logic.

Step-3 :

Create file to interact with DB to get data. This file can contain user-defined functions.
Example :

Step-4 :

hook is new_folder. create hook_block in new_folder.module file. hook_block is used to display the block in admin page and view the content in admin/learner page. The block can be assigned to particular region for corresponding theme.
Example :
function exp_sp_survey_learner_block($op='list', $delta=0) {
	switch($op) {
		case 'list':
			$blocks[0] = array('info' => t("Learner Survey"));
			$blocks[0]['cache'] = BLOCK_NO_CACHE;			
			return $blocks;
		case 'view':
			switch ($delta) {
				 case 0:
					$blocks["subject"] = t("Learner Survey");
					$blocks['content'] = getsurveyDetails();
					return $blocks;
In the above example, first case to display the block information in admin page.
The second case to store the content which is retrieved from file. the content to be passed to block-new_folder.tpl.php of theme_folder.	

Step-5 :

      Use Camel case to define new function.
Example :
function getSurveyDetails(){ 	
	return 'content';

Step-6 :

Create a block-new_folder.tpl.php file under themes/core/expertusone/templates folder.
Example :

Display a block for particular pages.

Step-7 :

After finished the above steps, we should assign the created block to some region in the build/block section.
Browse the below the URL in browser,
Here we can find the block info name which we specified in the file.
Assign this module to some region.
Once assigned the module, click on 'configure' link which is near by region dropdown in the same page.
	Example :
In the upcoming page, put the below entry under 'Pages' 
	Example : learning/survey-details
Click on 'Save block' button

Now we can test our module by browsing the below URL.


internal/dev_w/module_creation.txt · Last modified: 2022/06/14 10:16 (external edit)