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?)
internal:dev_w:menu_creation

Steps to follow while creating a new menu through code:

step-1 : Create new menu using hook_menu() at the module file, here we need to give permission name to 'access argument' field.

Example :
$items['portalpages/sp_administrator/store-admin/orders/%uc_order'] = array(
    'access arguments' => array('view all orders perm'),
);
here 'view all orders' is permission name.

step-2 : Permission name should be specified in hook_permission() function at the same module file.

Example :
return array(
    'view all orders' => array(
      'title' => t('View all orders perm'),
    ),
);

step-3 : The permission name and menu name should be included in master data(sp_table_data.sql).

How to include permission name for the newly added menu on the master data(sp_table_data.sql) file?

step-1 : get root menu id from 'slt_profile_list_items' table as below.

SELECT * FROM slt_profile_list_items WHERE name='Commerce Administration';
Here 'Commerce Administration' is root menu name.

step-2 : add a new insert script at the end of 'slt_profile_list_items' insert records, which is in 'sp_table_data.sql', as below

insert  into `slt_profile_list_items`(`code`,`lang_code`,`name`,`list_id`,`parent_id`,`stats1`,`stats1_desc`,`stats2`,`stats2_desc`,`stats3`,`stats3_desc`,`stats4`,`stats4_desc`,`is_active`,`attr1`,`attr2`,`attr3`,`attr4`,`created_by`,`created_on`,`updated_by`,`updated_on`,`custom0`,`custom1`,`custom2`,`custom3`,`custom4`) values ('cre_sec_pmn_adm_006_001','cre_sys_lng_eng','Orders',54,35446,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Y','','','','view all orders perm','1','2011-05-04 18:15:28',NULL,NULL,'','','','','');

Note down the dynamic fields:

  • code is any code that should be meaningful for the given menu
  • name is, menu name
  • parent_id is the root menu id which we get from step 1 query.(If the added menu is root then specify NULL for parent_id
  • attr4 have the permission name
  • created_on, mention the current with given format.

Note:

This is advisable to give unique name for permission name to avoid the conflict state.

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