Skip to content
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

Add/single staff member block #108

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

brettshumaker
Copy link
Owner

No description provided.

This is a big commit. Adds a functional single Staff Member block. There are still a few bugs to work out and still some work to do on the admin rendering, but it's a pretty good start.
Ok, this seems to be working now.

A dynamic block that renders the shortcode on the front-end and also uses `<ServerSideRender />` to render the shortcode in the admin area too.
Accidentally introduced a bug where the block would automatically select the first search result with no interaction from the user.
I'd like to offer a better way to template out the staff member loops. I'm marking this block as "legacy" because we're using the shortcode to generate the output. I'll be building "new" blocks that will have a few different layout options and the ability to hook into them and add additional layouts.
- Fixed error when Staff Member did not contain a photo.
This adds a Gutenberg-first (not utilizing the shortcode) dynamic block. And likely renders the legacy block from #104 useless because I added the "Staff Loop Template" for a layout option.

It contains 3 layout options:
- image left, content right
- content left, image right
- image top, content bottom

You can control the fields that are shown on each Single Staff Member block via toggle switches in the `Content Options` panel. **TODO: make these filterable? Would allow users/plugin developers to add their own custom fields.**

All functions that handle the layouts, and all block field render functions are pluggable in that a user can add a function with the same name to their theme and it will be used instead of the function contained in Simple Staff List.
This is a big commit. Adds a functional single Staff Member block. There are still a few bugs to work out and still some work to do on the admin rendering, but it's a pretty good start.
Ok, this seems to be working now.

A dynamic block that renders the shortcode on the front-end and also uses `<ServerSideRender />` to render the shortcode in the admin area too.
Accidentally introduced a bug where the block would automatically select the first search result with no interaction from the user.
I'd like to offer a better way to template out the staff member loops. I'm marking this block as "legacy" because we're using the shortcode to generate the output. I'll be building "new" blocks that will have a few different layout options and the ability to hook into them and add additional layouts.
- Fixed error when Staff Member did not contain a photo.
This adds a Gutenberg-first (not utilizing the shortcode) dynamic block. And likely renders the legacy block from #104 useless because I added the "Staff Loop Template" for a layout option.

It contains 3 layout options:
- image left, content right
- content left, image right
- image top, content bottom

You can control the fields that are shown on each Single Staff Member block via toggle switches in the `Content Options` panel. **TODO: make these filterable? Would allow users/plugin developers to add their own custom fields.**

All functions that handle the layouts, and all block field render functions are pluggable in that a user can add a function with the same name to their theme and it will be used instead of the function contained in Simple Staff List.
@brettshumaker brettshumaker marked this pull request as ready for review March 16, 2021 13:26
@brettshumaker brettshumaker marked this pull request as draft March 16, 2021 13:28
* Adds /sslp/v1/block-layouts/ endpoint to get available layouts for context
* Adds filters to set the default layout and content options:
    `sslp-single-staff-member-block-attribute-default-layout`
    `sslp-single-staff-member-block-attribute-default-content-{{content name}}`
* Adds filter for adding custom layouts `sslp-custom-block-layouts`
* Slight change to the structure of attribute content used in layout callback functions - now has the "name" as the index
Removing the "Single Staff Member (Legacy)" block - it's not needed now that we have a template selector in the main block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant