< 122022-12-13⋎14 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
00:00*cosine has quit (*.net *.split)
00:02*cosine has joined
14:44mstenta[m]What do y'all think about this as a simple first step before 2.0.0? github.com/farmOS/farmOS/pull/619
16:39mstenta[m]Also for review: www.drupal.org/project/farm/issues/32447
16:40mstenta[m]Note: I just whipped that one up as a quick proof of concept to keep the conversation going - if others don't think it's the right approach we can discuss - just eager to close stuff :-)
17:20symbioquine[m]<mstenta[m]> "Also for review: www...." <- Looks reasonable to me - though I don't know much more about it than what we talked about on that call...
17:20symbioquine[m]Will use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay; work without layout_builder installed?
17:20mstenta[m]oh i think so?
17:20mstenta[m]it's a good question
17:21mstenta[m]i'll see right now... i'll just uninstall layout_builder and make sure everything still works :-)
17:21symbioquine[m]Cool
17:33mstenta[m]> Will `use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;` work without layout_builder installed?
17:33mstenta[m]works fine!
17:33mstenta[m]i think that makes sense actually... PHP has no concept of "modules installed"
17:33mstenta[m]that code exists, so it's happy
17:33mstenta[m]it's just not going to be used
17:34paul121[m]<mstenta[m]> "Also for review: www...." <- how does this work with multiple view modes? I think it only alters the `default` right now, which is good. But it seems that these `asset_preprocess__full` hooks would be run for all view modes?
17:35symbioquine[m]mstenta[m]: And it's part of core right so it's always present?
17:35mstenta[m]paul121: oh hmm, maybe my assumptions were wrong - i thought `full` WAS the view mode (but you're right it's technically called `default`)
17:35mstenta[m]symbioquine: correct
17:36mstenta[m]paul121: the map_popup view mode is also enabled
17:36mstenta[m]always has been - and that doesn't get affected by the layout logic
17:36paul121[m]yeah, maybe there is something weird where full == default ?
17:36mstenta[m]yeaa... maybe?
17:36mstenta[m]it's a good question
17:38mstenta[m]drupal.stackexchange.com/questions/16611
17:39mstenta[m]> So, when you are going to node/1, there is by default no display for `full`, so it falls back to default. Whereas `teaser` does have one, so it uses different things. However, you can also enable a form display for `full` and then it will no longer use `default`.
17:39mstenta[m]🤔
17:41mstenta[m]i don't see where you can "enable a form display for `full`" anywhere in the UI
17:42mstenta[m]second answer says:
17:42mstenta[m]>
17:42mstenta[m]There is no difference between default and full, they are essentially the same thing. "Full" is just a view mode and for some entities that is the "Default" view mode (not all though).
17:42paul121[m]> view_mode can basically be anything you want, you can even make up them on the fly.
17:42mstenta[m]s///
17:42paul121[m]??
17:43paul121[m]Well, I think what you could do is create a new full view/form display
17:43paul121[m]just like we made the map_popup
17:43paul121[m]Drupal core must provide a standard teaser view display for nodes
17:44mstenta[m]ah ok
17:44mstenta[m]yea that sounds right
17:45mstenta[m]ah hmm... there is a difference between "view mode" and "view display"
17:46mstenta[m]default is the display
17:46mstenta[m]full is the view mode
17:46paul121[m]so right now we're technically altering the default and full view displays, if someone happened to make a full then it would be changed
17:47mstenta[m](see comments on the first answer)
17:47paul121[m]yea, grokking that too.... I think "view mode" is just the name for the parameter passed to EntityViewBuilderInterface, nothing more
17:48paul121[m]www.drupal.org/docs/drupal-apis/entity-a
17:48mstenta[m]so do you see any issue with this logic?
17:49paul121[m]paul121[m]: wrong! view mode is the config entity too: `core.entity_view_mode.node.full.yml`
17:50mstenta[m]ah
17:50paul121[m]but also the parameter passed to that method. which, a view_mode config doesn't exists, it uses default :-)
17:53mstenta[m]so just to recap:
17:53mstenta[m]1. if you go to "Manage display" for an asset type, and you enable "Use layout builder", it creates a `core.entity_view_display.asset.BUNDLE.default` config
17:53mstenta[m]2. we are implementing `hook_preprocess_HOOK()` to alter the theming of `asset__full`, `log__full`, and `plan__full`
17:53paul121[m]mstenta[m]: I don't think the `default` view mode should be hard-coded here: git.drupalcode.org/project/farm/-/merge_
17:53paul121[m]only because this *could be* the `full` view mode too. kinda an edge case
17:53mstenta[m]so, we are specifically altering the full view mode... which is using the default display
17:54mstenta[m]what should be there then? full? I'm not sure that would work
17:55mstenta[m]default is the config that gets written to when you enable layout builder
17:55paul121[m]yeah me neither. I wonder if we should use a different preprocess hook somehow
17:55*spitz234[m] has quit (Ping timeout: 252 seconds)
17:56paul121[m]well you could write config to the full display as well (if you created that view mode)
17:56*spitz234[m] has joined
17:56paul121[m]but that is an existing issue, not new. this change just revealed it to me :-)
17:57mstenta[m]yea that makes sense
17:57mstenta[m]well i don't want to open up a too much of a can of worms
17:58mstenta[m]still trying to understand the potential issue...
17:58mstenta[m]right now, someone will most likely enable layout builder on the default display
17:59mstenta[m]but you're saying that IF they created a full view mode, and then enabled it on that, then this would break... ?
17:59mstenta[m]i think i see what you mean - does seem very edgy
17:59mstenta[m]hmm
18:00paul121[m]yes. but full display mode is a common convention for drupal nodes it seems, so not too far out
18:01paul121[m]common convention... it's like baked into the core code as the default view mode haha :P
18:01mstenta[m]yea
18:07paul121[m]maybe hook_entity_display_build_alter: api.drupal.org/api/drupal/core!lib!Drupa
18:07paul121[m]but we prob don't need to fix this right away
18:14paul121[m]an alternate approach... we could depend on layout builder and dynamically build/override the default view display to use the two column layout as needed? its a bit more complicated so I understand why we didn't do that in the beginning. but if might solve all the problems now?
18:58mstenta[m]yep!
18:58mstenta[m]we could consider that!
18:58mstenta[m]in which case i would say let's punt until after 2.0.0
18:59mstenta[m]so: should we postpone this issue?
18:59paul121[m]yea, that sounds good
19:00mstenta[m]alrighty!
19:02mstenta[m]this one good to merge? github.com/farmOS/farmOS/pull/619
19:03mstenta[m](seems like you suggested as much paul121 - just wanted to be sure before i pull the trigger)
19:03paul121[m]yep!
19:03paul121[m]LGTM
19:03mstenta[m]cool!
19:03mstenta[m]i will focus on the timestamp thing now
19:03mstenta[m]just needs tests

< 122022-12-13⋏14 >