New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show map on /locations #779
Conversation
See this comment for details on what will be necessary for the next step (adding the map to /asset/[id]/locations): https://www.drupal.org/project/farm/issues/2551091#comment-15403543 Tl;dr: the main thing we need is a custom contextual filter for asset parent that we can use in our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's worth it, but this could be made backwards compatible (in case any other folks modules might be depending on the map type) by keeping the 'dashboard' map type and issuing a deprecation warning from the event subscriber.
modules/core/ui/map/config/install/farm_map.map_type.locations.yml
Outdated
Show resolved
Hide resolved
Removing the
I think its possible that we intentionally provided this map type in
I do like the idea of a |
Thanks for raising this @symbioquine and @paul121. I agree we should keep the
I like this idea too...
Yep that's the challenge.
Just to clarify, did you mean to say "check if a map has the We will also need to add a new |
b638ce4
to
0d88c57
Compare
OK I refactored my branch to try out the approach described above. Seems to be working. What do you think @paul121 @symbioquine? Some notes:
|
I just pushed two more commits which remove the need for the JS file entirely, by making the |
Oh, I do think we should have a I do see how a
Nice, I agree this isn't a requirement for the dashboard map, but I do think this would be most proper for a
Ah interesting. I suppose that is OK but wonder if there are useful helpers or abstractions we could build into the JS side of this? Maybe once we try to limit the assets to those with a given parent? |
I just pushed a few more commits, mostly fixups...
Ah gotcha. OK I pushed a
Agreed. I pushed a commit that reverts the addition of the
I realized that it is possible to edit the behaviors of So... I also pushed a However, in doing so, I found that the logic I added in an earlier commit was only checking for the
@paul121 I just want to be sure you saw my follow-up commits which remove the need for that blank JS file. Now the |
e972f18
to
cb0089b
Compare
These other changes make sense 👍
Interesting. I would have thought MapType::load(), ->set(), ->save() would work. Kinda surprising. Maybe we could look during the dev call?
At first it seemed a little weird but I'm seeing how this could be useful :D Sounds good. |
c29117e
to
ce04b86
Compare
ce04b86
to
8b428bd
Compare
Rebased onto 3.x, merged fixup commits, and changed the update hook to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not tested, but LGTM!
We implement hook_farm_dashboard_panes() but that will only run if farm_ui_dashboard is enabled. It doesn't depend on it. Removing this hard dependency allows farm_ui_dashboard to be disabled without disabling farm_ui_map.
$this->configuration['map_behaviors'] will already be an array of values, not an associative array of behavior machine names and their labels. The necessary form value conversion using array_keys() happens in MapBlock::blockSubmit().
8b428bd
to
471e2cd
Compare
This PR takes the first, simplest, and most impactful step towards Issue #2551091: Show map in /locations and /asset/[id]/locations.
It adds a map of locations to the /locations page in farmOS.
It does NOT add a map of locations to the /asset/[id]/locations pages. This has additional complexity, and I don't think there's a lot of value in taking this first step, and tackling the second part in a follow-up.
This PR also makes another general change, which is to rename/replace the current
dashboard
map type alocations
map type (and also cleans up some dependencies). The thought behind this change is that the currentdashboard
map type is not dashboard-specific at all (other than the fact that it's only used on the dashboard). It is provided by thefarm_ui_map
module, not thefarm_ui_dashboard
module, and it adds layers for all locations to the map. So this just generalizes that to be more reusable, and then uses it in the /location page.This needs CHANGELOG.md line(s), and will be saved for 3.1.0, so I'll leave it as a draft for right now.