-
Notifications
You must be signed in to change notification settings - Fork 5
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
Expose inputs for loop blocks #418
base: trunk
Are you sure you want to change the base?
Conversation
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
Test this PR in WordPress Playground. |
@brookewp This looks great! I'm excited for both the filter options and the easy retargeting a block to a new ID. Testing now. |
@brookewp Noticed an odd bug that happens after you pick an item from the Art Institute block, and then pick another one on the same page: Screen.Recording.2025-03-20.at.12.38.19.PM.movReproduction steps
Notes
|
register_remote_data_block( [ | ||
'title' => 'Art Institute of Chicago Loop', | ||
'icon' => 'art', | ||
'instructions' => 'This block displays a set amount of artworks based on the provided limit.', |
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.
Signed-off-by: brookewp <[email protected]>
Signed-off-by: brookewp <[email protected]>
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.
With the exception of that one pattern issue (that I'm not 100% sure is related to this feature), this works great! Feel free to merge if you fix the pattern issue or determine it to be unrelated.
Thanks @alecgeatches! I can replicate the issue you found in trunk after rebuilding my env. I'll open an issue/PR for that separately. |
This might be replaced by the work in #405, but it's a small step towards the goals there.
This adds a special type
ui:input
andloop
type selector whenloop: true
so we can use that to show inputs when relevant.Returning all results filtered by an input (e.g., categories/collections) is a common use case, so examples of this have been added for Shopify and Salesforce. I also added an example in the Art Institute to set the number of results returned. A visual example of all three of these can be seen here:
Screen.Recording.2025-03-12.at.6.16.52.PM.mov
Updated to include input in the query panel to update any selection:
Screen.Recording.2025-03-19.at.11.09.41.AM.mov
Note
I ran into a few things that we will want to consider when setting up queries, relating to the UI. One thing is a way to add text to the placeholder, as the generic text won't work in all cases and might not be the same as a block description. So for now, in this PR, I've added
instructions
, but this could change with #405. Also open to alternative suggestions here!Testing steps
Try new block(s) and add input
Select the parent block and edit the ID in the block inspector panel