IRC logs for #farmOS, 2020-07-30 (GMT)

2020-07-29
2020-07-31
TimeNickMessage
[21:48:25]* JustTB has quit (Quit: Leaving.)
[01:24:09]* JustTB has joined #farmos
[08:56:58]<tool172[m]>can you have more than 1 hook menu per module area or will i have to explode into folders?
[08:57:10]<tool172[m]>sorry. i got the json data flowing, now i'm working on formatting translating etc
[08:58:00]<mstenta[m]>Hi tool172 - sorry meant to follow up yesterday but dinner, kids bedtime, etc :-)
[08:58:20]<mstenta[m]>Glad to hear you figured it out!
[08:58:49]<mstenta[m]>A module can only have one `hook_menu` function, but it can provide multiple menu items
[08:58:57]<mstenta[m]>`hook_menu` returns an array of items
[08:59:10]<mstenta[m]>https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
[17:15:25]<tool172[m]>so i have one hook right now for the api key storage in farm settings
[17:15:43]<tool172[m]>but i would need to either subfolder that or are you suggesting a better way with returning the arrays
[17:15:44]* alexandria[m] has joined #farmos
[17:15:57]<tool172[m]>the Drupalize is confusing me, php not so much - i can grind that out
[17:23:02]<paul121[m]>tool172: do you mean something like this? https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_area/far...
[17:23:09]<tool172[m]>well
[17:23:24]<tool172[m]>i could use like farm maps, make a sub folder (module within a module) with 2 hook menus
[17:23:27]<paul121[m]>that implementation of `hook_menu` returns multiple menu items. just an example
[17:23:27]<tool172[m]>one to store the api key
[17:25:01]<tool172[m]>right, but i need a hook item for the settings page and another for the actual reports
[17:25:54]<paul121[m]>you should be able to do it in the same module
[17:26:37]<paul121[m]>does that make sense, returning two items from `hook_menu` ?
[17:47:22]<tool172[m]>that's where my mind is blown
[17:47:24]<tool172[m]>i need a visiual code example
[17:48:40]<paul121[m]>check the link above! :-)
[17:50:04]<tool172[m]>and each hook array is only called by the runtime libraries or whatever when needed
[17:50:07]<tool172[m]>?
[17:50:16]<tool172[m]>it's the magic that always gets me with this thing
[17:51:25]<tool172[m]>well menu array
[17:51:52]<paul121[m]>haha yea there is some magic that happens there (some hooks are cached and not called as often)
[17:52:10]<paul121[m]>but the values you return are merged with all the others
[17:52:30]<tool172[m]>once i get this thing parsin json into views i'll strip out and modulize it and git repo it
[17:52:38]<tool172[m]>right now its strung across in php files
[17:53:09]<tool172[m]>i should buy php storm, i'm using notepad++ and winscp and my apache server
[17:53:46]<paul121[m]>yeah... php storm is nice. having the debugger helps see whats going on
[17:54:27]<tool172[m]>as always thanks guys
[17:54:36]<mstenta[m]>"hook_menu()" only runs occasionally. It is used to build the "{menu_router}" table in the database. That is what's actually used when a request comes into Drupal
[17:54:45]<tool172[m]>i'm making good progress right now...i'm tied in with the api and the json is flying in
[17:54:59]<mstenta[m]>It looks at the requested path and then looks that up in the database to find the callback function for it
[17:55:51]<tool172[m]>mentally i'm thinking of having some callbacks to shift the json requests around
[17:56:01]<tool172[m]>through a case in the hook when it runs
[17:56:52]<tool172[m]>then use Data to serve it as maps or i can us d3
[17:56:57]<tool172[m]>use not us
[17:58:20]<tool172[m]>i need to road map this because we can link it with livestock stuff
[17:58:39]<tool172[m]>and actually estimate income in nrt based on historical averages for stockyards etc local
[17:59:36]<tool172[m]>cash crops are also reported