This is ready to be tested. Views in particular that was indeed missing JS attached. Another thing that (accidentally : ) ended up here is having the actual active slide, the one that was clicked, loaded as a starting one in the Dialog instead of the first slide as it was.
Thanks, appreciated.
There is no much sense. attaching the patches for what's not in dev. Could you re-roll -please and upload here so we have it review? Thanks.
To keep consistent with phpcs and the whole codebase we should use dependency injection rather than \Drupal::moduleHandler()
This make sense and it should not be difficult to implement. However, I'd still like to clarify the exact usage (example), mostly to try to predict a bit further when making it.
Could you please explain the situation where this would be useful? Considering the fact that for different settings we can have different Swiper templates (entities). Thanks!
Ok, so here's the tiny patch that shall do it. Whoever is able - please do test on entities other than Taxonomy term, thanks!
@bbu23 I see you are busy with some code, please include this patch once it is convenient for you, cheers.
That's a good point and, in fact, first steps towards that are already there. If you fetch 2.0.x-dev
version you will see package.json
there (as well as the new option for "Source" of the swiper, "Package". If you
npm install
npm run build
And have selected Package
for Swiper template in question you will see it's working. What is weird however, Element
is not really recognized, because for quite a while I am busy with Ckeditor5 implementation of Swiper here (from time to time when I catch some time :) and for that, all goes really perfect when using as element inside CKEditor5 scope. Once it is saved as such markup in drupal and later viewed on page, it simply does not work, even though <swiper>
and children would still have all required classes.
Long story short, there's a bit more here to do but is coming as more broad solution. And thanks for pointing indeed!
@jcl324 I am sorry, I am not managing to catch up on this one but soonest.
@bbu23 In case you have a chance, we'd just need to test situation where:
There is Swiper images/dialog formatter on the image field that is attached to Taxonomy term entity. That image field shall have both Title and Alt field enabled, some values for it entered on example terms entity testing items.
A bug to confirm - there is no option to select Title or Alt field as a Caption on the formatter settings.
Actually neither usage with Advanced PW nor ECA (especially) were tested. Since ECA utilize Push framework and since this module just adds on DANSE which are all from the "same family" I would not be surprised if setting up with ECA already works.
@ugintl Care giving it a try, ECA?
Thanks @sebastix.
@kopeboy I can confirm that I see the problem with service worker, this is a painful part. Could you please tried same what I just did, in th Application tab click on "Unregister" and reload some pages, see if page not found error is there. Problem is, as I see it, we can't (or at least easily) unregister service worker from user's browser. This is where "Unlock" button on its config helps a bit, ideally it should clean up those kind of things but that needs to be then clicked before uninstall which is far from good UX imho. To make this happens automatic with uninstall is a true challenge at the moment but we should definitely improve. It might need a deeper look into how PWA does it with its service worker...
As for the Notification does not get created at all - so far I do not think it would have to do anything with this module. did you check DANSE subscriptions? Are these there and ok? If not, then that's why no notifications created but if yes then I am pretty sure we do not have anything with it. It would be appreciated if you have a chance to give more info, thanks!
@man-1982 Thank you, your initiative and code was crucial to have this moving on. As you are aware, the module was needing some sort of general redo and a new version, for quite some time, so ultimately your code wasn't matching with a new structure which does not make it less appreciated or useful.
Heads up to everyone following - I just pushed a new versions with a couple of relative important fixes. According to config_inspector → there are still some issues with schema, details, but these, so far, do not break anything and shall be fixed before the release.
@bbu23 thanks so much for hopping in here and for the precise work you do with code!
Oh, how did this one slip in, I was "sure" this one stayed. Anyhow, just pushed a fix, care to give it a quick try, lear cache and try to reproduce. Thanks a lot!
Pushed into dev and ready for testing.
@kumkum29 the change would be an easy one unless I am missing something. Does the other folks agree? I am thinking to leave the current dev version that is including it for the next 7-10 days like so testing everything and voting welcome!
Pushed into 2.0.x-dev and ready for testing. Thanks!
Also included in 2.0.x-dev version as of now.
Merged and pushed into 2.0.x-dev just now, so changing the version here too.
Not clear what is the goal here? Also, change in the form code is not enough because schema defines this field as integer so no saving as string.
Thanks. I was not able to produce this so far, though with a very basic example on existing commerce web site? Maybe more background info on theme/assets/caching other stuff on your end? And honestly, I do not prefer putting back jQuery dependency in 2.0.x version, especially not for just one line of code.
Thanks. I thought it was safer to do make this logic in PHP, so I placed a few lines of code in the module to not even initialize swiper but do inform (status warning) user about it.
Note that this is only in 1.0.x-dev version for now. For 2.0.x will come soonest
Included in the latest 1.0.x-dev version, freshly pushed and in a relation with a new feature ✨ Add support for opening Swiper in a modal window via swiper_formatter settings Needs review . Let us know if you can test and confirm so we can close this one, thanks.
Thanks again Andrii for your commitment, it is very appreciated. However the code for 1.0.x version was quite outdated so thanks to motivation gained from you and the other folks I went into a sprint mode and completely re-wrote the code, covering this feature, quite extended with possibilities in comparison with your initial idea as well as some other pending issues here. In shortest this is what is new
Dialog feature.
Please see screenshots below.
- There is total 3 new field formatters for Dialog feature:
- Swiper entity Dialog - can popup own entity with selected mode (which again can be swiper but in modal), or referenced entity with its mode selected, or a rendered field or rendered field item (e.g. only field item with delta=0) for both entities, own or referenced.
- Swiper images Dialog - can popup own entity (if the same view mode it'd be swiper in dialog) or just an image with Entity field item selected as Dialog content.
- Swiper markup Dialog - same like images.
- Dialog can be one of 4 Drupal ui dialog types:
- Modal
- Dialog
- Dialog off canvas
- Dialog off canvas top
- 3. There is quite some Dialog options provided, configurable, such as width, height, ui classes etc.
- 4. Tokens implementations. Can be used for dialog title and/or custom link on plain images formatter.
- 5. Pure drupal dialog implementation without additional JS.
Other improvements
- Disabled view modes for entities are not shown anymore on swiper formatter settings.
- All the above is re-done considering latest code standards and php 8.x compatibility. There are few services, interfaces, routes and controller to run dialog callbacks etc.
- Included patches/issues:
- - https://www.drupal.org/project/swiper_formatter/issues/3472606 ✨ Access to Sliders within Theme JS Active
- - https://www.drupal.org/project/swiper_formatter/issues/3464557 ✨ Allow swiper template names as theme suggestions Needs review
- - https://www.drupal.org/project/swiper_formatter/issues/3403505 🐛 Warning: Undefined array key "#theme" in Drupal\swiper_formatter\Plugin\views\style\SwiperFormatterStyle->render() Fixed
- - https://www.drupal.org/project/swiper_formatter/issues/3479245 🐛 JS Warning About Not Enough Slides Active
- - https://www.drupal.org/project/swiper_formatter/issues/3474010 📌 Coding Standard issues Needs work
For now, this is only 1.0.x dev version, 2.0.x version is yet to come, it shall include these and a few more features developed there in the meantime. Testing and feedbacks are very appreciated and I am thankful in advance! Next week I am going to be occupied a lot with the other things but will keep an eye on this one. hoping to have it confirmed by crowd and packed into next 1.0.x release.
.
.
.
I agree that we shouldn't run new version as they come, that was after all the original reason for not defining url with @latest, or the other token. So let's keep it as it is for now.
In fact, I believe it is worth considering implementation of https://asset-packagist.org/ or similar, at least as an approach.
A good find, thanks again for checking in here. I included that in the very first release 1.0.1-beta1 and, as usual, any future feedback super appreciated.
Hmm, I totally can't produce this error. Nothing in the logs as well and I installed fresh copy of Drupal 10.3.2. First off flood_control → is a contrib module so it might be something for issues there.
Ah, well, as usual when it's A bummer day, it was a typo in pf_notifications.info.yml
file, nothing wrong in composer.json. So danse_content:danse_content
instead of correct danse:danse_content
. Thanks for all the reports so far!
This is one of the weirdest scenarios I've seen lately, just tried a few things to try to fix but no luck yet. There is nowhere "drupal/danse_content" in composer, now not even "danse/drupal" (since push_framework requires that). Any idea? And thanks a lot for so far invested time!
Oh, a bummer :) Thanks a lot Sebastix, just pushed a new version!
Not sure if entirely relevant to this issue, apologies in case... I've built a module which implements Web Push library for PHP, DANSE and Push framework, tailored and tested - a single case scenario though - to work with PWA. Here: https://www.drupal.org/project/pf_notifications →
Based on some ideas here - I developed a module that does exactly that. Please check it out:
https://www.drupal.org/project/pf_notifications →
It is in dev version for the moment but the release is planned for some time late next week. Feedback more than welcome!
I see. Obviously Swiper works on fields with multiple instances so at the moment I can only assume that you might have "Allowed number of values" set to 1?
On your screenshot I do not see which type of field is that. Swiper will work on multiple Image fields or multiple Text fields or Media entities or Paragraphs (swiping each paragraph instance as a slide). I think you are looking for the wrong field or the wrong way to implement.
Image field formatters also generate unique ID. I asked if you can confirm that in your case all have unique ID? Including nested ones? Or some have very the same?
Good, so I would like to mark this issue as postponed. In the meantime, I would not be much surprised if things would work in your case as long as every Swiper has unique ID attribute, meaning parent and nested ones. Did you check on that?
Also, you might have more than actual, or valid swipers, in the object containing multiple swipers
swipers[]
or that is as much as it should be but some are malfunctioning. You could also maybe put
console.log(swipers)
at the specific place and inspect and/or share here what's there. See screenshot.
I took a quick look into your export but couldn't find anything like "suspicios". Can you make a screenshots of Development console in browser where we can see html/markup of all swipers on the page?
@abhishek_gupta1 thanks, I will definitely include this in the next version.
@RgnYLDZ
1. Are you by chance loading swiper main js in a "strange" way?. Like somewhere in html.twig template or similar and not part of formatter (and views style)
2. I assume you did try in a few different browsers with a clean cache?
3. Are all swiper instances made by View, or? some yes some not? can you export the view in yml and share by chance?
No problem, glad if I can help. My first thought may be - is there anything (contrib or custom module or theme) in your environment that is extending StylePluginBase or even SwiperFormatterStyle instance (this in some kind of custom code)?
That make sense indeed. I am currently busy with a new release, with CKEditor5 included, once I am there I will do my best to include this option as well. In the meantime any patches welcome. Additional code would require schema update, default settings and the Swiper entity form changes at least.
That's a weird error because base class' method is protected indeed. I took a quick look for 10.2 and 8.8 versions:
https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/modules/vie...
https://git.drupalcode.org/project/drupal/-/blob/8.8.x/core/modules/view...
So what's your version of Views/Drupal core?
I can't reproduce this, everything works normal in my case and there is "on" method available for Swiper object. Error does not make sense to me since a line before checks on swiper instance existence.
Is there any other (preceding) JS errors in console?
Which browser is used?
Do you load Swiper from local path or from remote CDN?
I just pushed a tiny change (swiper event type) into dev version but I doubt that's the cause. Would you be able to test that? It would be very appreciated, if it works for you especially to test breakpoints with different pagination type, e.g. one to be dynamic bullets and the other fraction.
It's published as beta4 release so you can use that as well. Make sure you run DB update script too, as explained here ✨ Breakpoints feature Needs review .
Thanks! Patched and pushed for < PHP 8.3 compatibility.
This is just released in 2.0.x branch. Please check out this issue: https://www.drupal.org/project/swiper_formatter/issues/3441764 ✨ Breakpoints feature Needs review which shall stay as the only one related to this feature for the time being. Closing as duplicate.
Thanks! Finally I was able to grab some time to include this property too. It is enclosed in the new 2.0.x version, just released. Please also check out this issue about Breakpoints feature: https://www.drupal.org/project/swiper_formatter/issues/3441764 ✨ Breakpoints feature Needs review partially related.
This is just released in 2.0.x branch. Please check out this issue: https://www.drupal.org/project/swiper_formatter/issues/3441764 ✨ Breakpoints feature Needs review which shall stay as the only one related to this feature for the time being. Closing as duplicate.
This is just released in 2.0.x branch. Please check out this issue: https://www.drupal.org/project/swiper_formatter/issues/3441764 ✨ Breakpoints feature Needs review which shall stay as the only one related to this feature for the time being. Closing as duplicate.
Thanks, this is indeed a good find, I don't think we ever tested image-on-paragraph situation like you explained. A bug was due the fact that Paragraphs have plural for it's bundle key - paragraphs_type
. I did commit and push a fix, tested previously into 1.0.x-dev version, appreciated if you give it a test. I also added this into 2.0.x-dev version previously and pushed.
Thanks for this one too, it is included in the latest 2.0.x-dev version. See also here.
Thank you so much for a great work on this one, as well as mousewheel ✨ Mousewheel support Needs review . I've tested both on 2.0.x version and just pushed it.
Version 1.0.x got some (important like) changes meanwhile so I assume patch won't work but we might consider re-rolling.
Thank you all! It was finally committed in the new release → , the last one supporting Drupal 8.8 and 9. A brand new branch 2.0.x → with quite some new features is there and recommended for a future use.
Thank you all! It was finally committed in the new release → , the last one supporting Drupal 8.8 and 9. A brand new branch 2.0.x → with quite some new features is there and recommended for a future use.
Thank you all! It was finally committed in the new release → , the last one supporting Drupal 8.8 and 9. A brand new branch 2.0.x → with quite some new features is there and recommended for a future use.
Thank you all! It was finally committed in the new release → , the last one supporting Drupal 8.8 and 9. A brand new branch 2.0.x → with quite some new features is there and recommended for a future use.
Thank you all! It was finally committed in the new release → , the last one supporting Drupal 8.8 and 9. A brand new branch 2.0.x → with quite some new features is there and recommended for a future use.
Thank you so much @Amirez, you rock!
Thanks! It was almost there, I made some changes, take a look into dev version that is just pushed. Most important change is forgotten Drupal\Core\Routing\RouteMatchInterface
inclusion, without it php error is thrown and help page is broken.
This shall not be the case, the module was tailored and tested on the platform that involves multiple events and thousands of entities (Speakers, Sessions, Exhibitors etc.) as well as a big group of most of the field types provided by Swapcard. There we are using it so for almost a year and never experienced this issue. I might be able to help but please provide me with more info.
- What kind of field it is? A custom field? Dropdown, or textfield or?
- If this is an options field type (e.g. select/dropdown) does it have key|value definitions on Swapcard? Our module syncs that too so in case it is this sort of field please check if those options (assuming existing on Swapcard) are also synced in Drupal?
- Are you sure that you actually did populate that field with at least one single value, at least at one Session?
- Did you try some options in the Debug section at the bottom of the module's config form?
- For debugging it's good to check in Swapcard's Graphql explorer here: https://developer.swapcard.com/tools/explorer
- Whatever does not show there will not in Drupal as well.
volkswagenchick → credited nk_ → .
Patched.
As for Breakpoints you mentioned, see here how you can easily implement it:
https://www.drupal.org/project/swiper_formatter/issues/3318311#comment-1...
💬
Responsive breakpoints
Needs work
Never put assets directly in Twig/HTML, this is for what you have libraries in Drupal.
Your best bet, very standard Drupal way for the situation when you want library literally everywhere, and that it does not multiply and conflict is this
/**
* Implements hook_page_attachments_alter().
*/
function YOUR_MODULE_NAME_page_attachments_alter(&$page) {
/* Attach this library just everywhere, with no config on pages/scopes where is normally triggered. */
// If you use default, CDN current version
$page['#attached']['library'][] = 'swiper_formatter/remote';
// OR remove previous line and have this one uncommented, if you are using local version.
// $page['#attached']['library'][] = 'swiper_formatter/local';
}
Or you can also try something like
{{ attach_library('swiper_formatter/remote') }}
in your twig (page.html.twig or html.html.twig) but I really do not recommend this.
Make sense, so I pushed to dev just now. Please take a hint and report back, thanks :) Not that, in general, you could also have a unique twig/html template, based on swiper template id.
I am not sure what you mean exactly, but of course there is a formatter for a regular image field. See attached screenshot.
This is a feature request and I could perhaps think of implementation if there's enough interest by community. Also, I'd prefer to have Views fieldsets module stable in Drupal 10. Previously there a few more important implementations on my to-do list, such as making CKEditor5 plugin for Drupal 10.