Juergen Posted July 15, 2019 Share Posted July 15, 2019 Hello, I have tried to get the config data of the ProcessPageAdd module because I need the pages which are inside the ASM-Select for the 'Add new' shortcuts. This is what I have tried according to the docs: $data = wire('modules')->getConfig('ProcessPageAdd'); print_r($data); But the only output I get is 1(true). Is there something I am missing or is this the wrong way? Maybe someone can help me out. Thanks Link to comment Share on other sites More sharing options...
elabx Posted July 15, 2019 Share Posted July 15, 2019 Maybe it's because the Array is printing as true? I don't see what could be going wrong! Have you tried: print_r($data, true); Link to comment Share on other sites More sharing options...
Juergen Posted July 15, 2019 Author Share Posted July 15, 2019 Same result, but I have checked the database (table 'modules') and the data column is empty. So I am wondering where the shortcuts pages are stored? Inside the module file of this module you can find following lines: $configData = $this->wire('modules')->getModuleConfigData($this); // because admin theme calls with noInit option $shortcutSort = isset($configData['shortcutSort']) ? $configData['shortcutSort'] : array(); So there must be an index 'shortcutSort' inside the configuration array. Very strange?!? Link to comment Share on other sites More sharing options...
elabx Posted July 15, 2019 Share Posted July 15, 2019 12 minutes ago, Juergen said: Very strange?!? @Juergen this is too much for monday! haha. But you know, looking at the config page, this list probably generated on runtime because there is also no way to delete them on the config screen, I took a look at the source code and I THINK, it's happening here, so maybe you can call executeNavJSON?: https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module#L151 1 1 Link to comment Share on other sites More sharing options...
Juergen Posted July 15, 2019 Author Share Posted July 15, 2019 3 minutes ago, elabx said: maybe you can call executeNavJSON?: Really complicated, but I will give this a try. I thought that it must be really simple to get the IDs of the pages in the shortcut navigation, but it isnt. Thanks for the tipp!!! 1 Link to comment Share on other sites More sharing options...
Juergen Posted July 15, 2019 Author Share Posted July 15, 2019 Now this works: $module = wire('modules')->getModule('ProcessPageAdd'); $test = ($module->executeNavJSON()); return $test; This gives me the following json-output: {"url":"\/processwire\/processwire\/page\/add\/","label":"Modules","icon":"plus-circle","add":null,"list":[{"url":"?parent_id=1016&template_id=57","label":"Eine neue Leistung erstellen","icon":"plus-circle","parent_id":1016,"template_id":57},{"url":"?parent_id=1048&template_id=51","label":"Neuigkeit erstellen","icon":"plus-circle","parent_id":1048,"template_id":51},{"url":"bookmarks\/?role=0","label":"Lesezeichen","icon":"bookmark-o","className":"separator separator"}]} And these are the pages I was looking for: list":[ {"url":"?parent_id=1016&template_id=57","label":"Eine neue Leistung erstellen","icon":"plus-circle","parent_id":1016,"template_id":57},/n{"url":"?parent_id=1048&template_id=51","label":"Neuigkeit erstellen","icon":"plus-circle","parent_id":1048,"template_id":51}........ So I get: parent_id: 1016, template_id:57 and parent_id:1048, template_id:51 These are the 2 pages that I have in the shortcut menu and the IDs that I need? So for the moment my new dashboard has the same functionality as the add-new navigation of PW, but a little more userfriendly than the small navigation in the left corner. New shortcut items can be added via the bookmark button, so every user can add his own favorites shortcuts to make his dashboard individually (if he has the rights of course ;-). 3 Link to comment Share on other sites More sharing options...
adrian Posted July 15, 2019 Share Posted July 15, 2019 Tracy's RequestInfo panel has all the details I think you are looking for: 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now