-
Notifications
You must be signed in to change notification settings - Fork 293
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
Implement Thank with Google supporter wall widget #5451
Comments
@felixarntz, can we extract this part for the modern block-based widget into a separate ticket since it will require a lot of work and considerations as to how to define custom blocks in our plugin, how to build them using webpack, and so on? I have defined the initial steps in this IB but I understand that I'll need to add much more and this ticket will be most likely 30+ which is not very good. |
@eugene-manuilov There may be a misunderstand here, the block implementation for this widget should not be part of this issue (in fact not even part of the TwG MVP requirements). So I also think that with the classic widget itself this issue should only be a 7 or less, not a 19. We explicitly did not include any blocks in the V0 to avoid all this complexity you're speaking about. The note in the ACs about widget previews working is only referring to the TwG JS snippet, which is needed for the preview to work. So I was thinking we should try to just inject the TwG JS snippet into the widgets admin screen, so that it would replace the In any case, developing a block here is out of scope. |
Ah... thanks for clarifying.... 🤦 I thought you wanted to build a preview for the new widgets block editor that requires widgets to be block based which is why I went with that block based approach.
Now I am wondering which preview do you mean then? Is it a preview of a post or something different? |
Have you seen the new This wasn't a problem prior to WP 5.9 because there was no preview, but now we need to make sure it works in relation to the script that is inserted for TwG. The widget itself will not work without the script, so we need to ensure it's somehow added to the screen. In short, we should ensure that the implemented
I think the Customizer preview should work out of the box, but even that we need to double-check. I'm sure to make the preview in the new Widgets admin UI work though we need to add some custom code to somehow inject the TwG script there. |
Yes, I saw it for sure, just didn't notice that the legacy widget component renders the preview for a legacy widget when it becomes inactive / looses the focus. Will update IB tomorrow. Thanks a lot for clarifications and sorry for misunderstanding. |
No worries, this was certainly a bit unclear and hard to explain. Hopefully we can figure out a simple way to make the preview work without some too crazy hacks :) |
Thanks, @felixarntz. I have updated IB. I think it should be good now. Do you mind reviewing it? |
@eugene-manuilov Looks great - nice to see that it looks like getting the JS snippet to work in the preview will be easier than I thought! IB ✅ |
@mohitwp we don't control what is shown when widgets are displayed on the frontend. The widget loads a javascript file for the TwG supporter wall and that script makes a decision of what should be shown. |
QA Update: ❌@eugene-manuilov while testing #5462 I discovered a few potential issues to highlight.
c.c. @mohitwp since you are testing this ticket too - just found them while testing another ticket. |
Those errors are expected at the moment and caused by the TwG script. We can't fix it.
What you see in the sidebar is controlled by the Gutenberg editor and that's how it treats classical widgets. We can't fix it.
Same, we can't fix it.
Did you search for legacy widget? |
I searched for Google but also legacy and nothing appears. When I use the Twenty Twenty Two theme, with full-site editing, and try and add a widget, its not appearing. On an older theme that isn't full-site editing, the widget does appear when searching for Google. I think this could be an issue unless I am missing where to add the widget? widget.mp4 |
@wpdarren looks like the legacy widgets component has been disabled for the new post editor intentionally, see a GH ticket for it: WordPress/gutenberg#24900. I think we shouldn't do anything with it until we create a new block-based widget for the supporter wall (which is currently is out of scope). If users want to use the widget with FSE themes, they will need to install a plugin that activates the legacy widgets block there: https://wordpress.org/plugins/x3p0-legacy-widget/ |
@eugene-manuilov @aaemnnosttv @felixarntz this could cause problems for users who have FSE themes. I feel we need to create a ticket. I am sure @bethanylang and team will get support requests. So, if it's out of scope then we need to prepare communication for this. We can move this ticket forward, but I'd welcome your opinions on this. |
Yes, we definitely need a separate ticket for it. |
Thanks for flagging this, @wpdarren! Agreed that we'll definitely get support topics about this and it's certainly not ideal, and we should create a block-based widget in addition to the legacy widget. That said, given that this feature will only be available for a small subset of users for now, I'm not sure if it's a blocker for initial launch, so curious what the rest of the team thinks. |
This feature will be available for all users who use non-FSE themes on their sites. FSE themes are not widely spread yet, so it should be the other way around: That said, given that this feature will only be available for |
@bethanylang thanks for the input. I will create a ticket for this before I leave for the day. @eugene-manuilov one final question (I hope) Is the widget set up to only work on one widget area? For example, if I add the widget to two widget areas in the example below, the widget outline only appears on one of the widgets. (widget 3) I'm just wanting to make sure that this isn't an issue if a user adds it on to the sidebar and then footer. Thoughts? |
@eugene-manuilov Yep, understood on the difference between FSE/non-FSE. I was referring more to the fact that this is an experimental feature and it's US only for now, as I understand it? |
@wpdarren if you open the source code of the page, how many occurrences of the |
@bethanylang Ah... yes, in this case you are correct, although I am not sure if we can consider US only users as a small subset though 😄 |
QA Update: ✅Verified:
Note: No design is appearing yet due to the API. Also the legacy widget does not appear on a FSE theme like 2022, but a ticket has been raised to investigate this issue as it will cause user support tickets. |
The TwG module will include a traditional WordPress widget for its "Supporter wall", which can be placed using WordPress's widgets screen. The widget UI depends on a JavaScript snippet being available, so this will also require relevant tweaks to the placement of that JavaScript snippet.
See #5450 for the code snippet that is potentially useful for QAing this issue. It is critical that usage of the widget is QAd for both the classic widgets screen (pre WP5.9) and the block-based widgets screen (since WP5.9).
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Supporter_Wall_Widget
class should be implemented, extending WordPress'sWP_Widget
.title
(standard like for other WordPress widgets).google_thankjs
script from Implement Thank with Google tag placement infrastructure #5450. (Since that is registered for the footer, that should work anywhere in the frontend that the widget is rendered.)title
(standard like for other WordPress widgets), and a description text: The color of the supporter wall is based on the color theme you selected in the Thank with Google module settings.Thank_With_Google
class (onwidgets_init
, as usual).TwG supporter wall placeholder
Implementation Brief
includes/Modules/Thank_With_Google/Supporter_Wall_Widget.php
file with the correspondingSupporter_Wall_Widget
class that extends theWP_Widget
class. It should have the following method:'googlesitekit-twg-supporter-wall'
'Thank with Google: Supporter Wall'
form
method should display the title field and the description text below the title: The color of the supporter wall is based on the color theme you selected in the Thank with Google module settings.update
method should save the new title value.widget
method should:google_thankjs
script if registered.register
method of theThank_With_Google
class to do the following if the module is connected:Supporter_Wall_Widget
widget by adding a new hook for thewidgets_init
action that calls theregister_widget
function with the widget class name.admin_init
action that calls theregister_tag
method if the current request has non-empty$_GET['legacy-widget-preview']['idBase']
parameter that equals togooglesitekit-twg-supporter-wall
.rest_pre_dispatch
filter that calls theregister_tag
method if the current request URL ends withwidget-types/googlesitekit-twg-supporter-wall/render
and the$request['id']
value equals togooglesitekit-twg-supporter-wall
.Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: