-
Notifications
You must be signed in to change notification settings - Fork 6
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
ISSUE-23: New Panorama Builder Webform Element #24
Conversation
There is just too much here: - New JS to deal with adding hotspots, keeping track, etc. - CSS - The new Element. Needs quite more work, settings, configuration options, etc. I s writing data to JSON correctly, but needs another commit to read it, because of the nested reality of the elements (its a single Render Element with a deep hierarchy) - Editing added Hotspots is still not working, but close. - New Drupal Ajax Command to add hotspots on the fly - Also, this brings also an improvement to the Entity Reference View Display we had. Now we can render out Thumbnails! Means visual auto autoselect! - Sadly it requires a patch in Webforms if ($element['#selection_handler'] != 'views') { //$options = self::translateOptions($options, $element); } at \Drupal\webform\Element\WebformEntityTrait::setOptions Because it assumes that views is the only views selection handler possible. Leaving our custom Solr Views Work out! And we did a great job convincing D8 that ours is legit! But not webfoms. Finally. Found out that Webforms can only Save Submissions (no worries, not our SBF!) like the ones that go into logs and its own Database that are 2 levels deep. Another big bug. So yeah.... 2 AM. I need to sleep.
This requires a second set of arguments One to include things another to exclude
When Nomintatim gives us no results, better to have those options initialized!
Don't code when tired. Don't. Don't Also. Removing for now Validation until its really working
src/Element/WebformPanoramaTour.php
Outdated
], | ||
'#button_type' => 'default', | ||
'#visible' => 'true', | ||
'#limit_validation_errors' => FALSE |
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.
Note to myself. This is affecting the Webform interaction when using them as ingest method. If this element is in any other step that the first, when pressed it resets the step counter (which Webform provides) and we go to step 1.
I wish i knew, now i know
Almost there. Saving and reading back of a single Panorama is working. Also JS loading of hotspots over existing ones in the Source Entity. Still `@TODO:` - Multiple Scenes loading for editing: Idea would be to pop first scene and do as we do now, store the other scenes in temp storage in the formstate, so we can use a select box to go back and forth. Would work the same to add other scenes - Remove the nasty hotspots_tmp array from form state during valueCallback. Tried and i killed hotspot generation via JS. I just need to cleanup those values when done processing, but not during interaction. I have some ideas, but need to re-recall the order of operation of all the callbacks we have, maybe i can even cleanup this during element validation. But pretty sure its Webform that is blindly pushing all internal elements into the #value key of the top/visible element, breaking the need. Will get there. - Remove all the debug statements! Looks like a Xmas tree now
Since Hotspots are not in the DOM yet, Drupal can not -ajaxify- them manually. This makes use of format_strawberryfield ISSUE-20 branch and simple adds, on hotspot add, Click handlers that open Modals with the content. All the logic is really on Strawberryfield Formatter.
This is done just to unify functionality since this was already working with the normal ajax-ify method of Drupal (since they become part of the DOM while dialog ajax is already loaded and get processed correctly).
No need to committ this sha-na-ni-gans Also, i never liked the idea of having extra data in the hotspot metadata. Now this looks better.
WIP but will commit. Now, if the #default value is an array of scenes, it takes the first scene and pops it into the #default saving the rest of the scenes in a temporary form state. I also remove the "Multiple" Option for this element, the idea is to have multiple Scenes in a Tour, but not Multiple Tours in a single Object. Too much overhead and adds little to the UX. A lot of new overriden stuff but also some cleanup and less hardcoded options. Not ready, but way better than today in the morning. tomorrow we will have this done!
Will use this to move hotspot part of the form to one side of the Webform element so make this "decent"
Make sure we can iterate over the thing there. Also, push back to HTML the hfov value. Used to define the initial horizontal field of view. We can do that now!
Still need to remove error_logs all over the place but now it actuall allows to change between Scenes, and add dynamically hotspots, swap back and forth and only saves what we need, more and not less. Also works when starting from scratch. Well, looking good and not failing after so many tests... Pretty tired, will just continue first hour in the morning. This is pretty sweet and i feel kinda the largest dev for realz in this panorama thingy we are into
Large app. But working
Not my taste, basically doing prefix and suffix. But no time today to do it proper prerender or preprocess callbacks.
Also should fix the JS that is hiding the search button on the top (weirddd)
This is just an exception when running beta2 on 8.7, which should never happen because our composer is asking for 8.8. But during dev it can get complex so better do this for now
but you know that...
This was missing. System calls know nothing about streamwrappers, and i happened to know that and neglected!
Not a fix yet, just cleaning some messy undefined options.
This is just for testing, disabling the select element in the meantime.
Finally got it working and did some cleanup. set initiaThis loads stored complex Panorama Tours and also creates new ones on the fly. Connects Panoramas to each other, allows Other Objects to be used as Pop Ups and also can set initial Position for panoramas, so you are actually looking to where you want they they are loaded, or via navigation you end there. Catch/main thing here is our valuecallback and the fact that we are dealing with an initial situation where form state is not being preserved because there is no form rebuild happening but also, cache has not happened yet. The fix is a little over worked and required tapping into the whole formBuilder class and looking at the exact data flow inside the formstates. For security, consistency, since this is an actual APP inside a single form element, we keep now the full 'All Scenes' complex array inside a Form State Value but also as an input, serialized as a JSON string in a hidden field. Feels over-engineered, but for some Webform reason, Value elements don't play well/nor are seeing by the ValueCallback and the Composite Webform base class. What is still needed now? More testing (tonight) and fill the holes of missing element validation callbacks, to make sure people actually do what is required. This will take me 3-4 more hours. 1200 lines of code to make this happen. UI/UX is such a wonderful thing.... SO HAPPY!!!
@marlo-longley i need this in for this iteration of Beta2. I know this has details all over the place but nothing serious breaking. So i will move forward merging. Please give this a look anyway and give it a general code reading. THERE IS A LOT! so feel free to comment inline and make questions. There is next-level code here (like the better Entity Selection View Handler) and also good old known friends. Beta2 process will mean we have 2-3 weeks for fix issues and then pack and move to Beta3. So nothing is final until it is. Thanks |
@giancarlobi i know you are so busy. But if you could (after merge, no pressure) just look at the files that changed here it would be great, mostly so you know where we are going. We will be constructing on some of this work for runners and also for IIIF (entity selection piece to push data of collection members into the IIIF Collection manifest Twig). I also know not this weekend, you have a quite heavy week. But i can't help myself mentioning you here!! |
Lastly @marlo-longley and @giancarlobi, since i never do such large pull requests i will not squash me merge here. I will keep each individual (including my failures) commits around so we can go back to each piece if needed. Feels better so. Thanks (now you are free of me!) |
What is new panorama?
See #24 23
There is just too much here:
Example:
if ($element['#selection_handler'] != 'views') { //$options = self::translateOptions($options, $element); }
This should become a patch for archipelago-deployment. Best solution would be to actually check if the #selection_handler set is an actual views, even a custom one. Instead of assuming all is provided by core. We are not CORE!
at
\Drupal\webform\Element\WebformEntityTrait::setOptions
Because it assumes that
views
is the onlyviews
selection handler possible. Leaving our custom Solr Views Work out! And we did a great job convincing D8 that ours is legit and follows the path to greatness! But not webfoms... webforms does not like it.Finally. Found out that
Webforms
module can only Save Submissions (no worries, not our SBF, those are handled by us!) like the ones that go into logs and its own Database that are 2 levels deep. Another big bug. So yeah.... 2 AM. We should force disable that option (override settings) when using our own Webform Handler. I need to sleep.@todo (next iteration since this is a beta2 and its already too large).
There were quite some issues on the fact i was building a Full app inside a single Form element, so the solution is over worked and required tapping into the whole formBuilder class and looking at the exact data flow inside the form states. For security, consistency, we keep now the full 'All Scenes' complex array inside a Form State Value but also as an
input
Value, serialized as a JSON string in a hidden field. Feels over-engineered, but for some Webform reason, Value elements don't play well/nor are seeing by the ValueCallback and the Composite Webform base class.