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

Since Gutenberg v8.8.0 oik-blocks doesn't list core-embed blocks #39

Open
bobbingwide opened this issue Sep 11, 2020 · 4 comments
Open
Assignees
Labels
help wanted Extra attention is needed

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Sep 11, 2020

core-embed is not available in Prefix select box. Why not?

@bobbingwide bobbingwide added the help wanted Extra attention is needed label Sep 11, 2020
@bobbingwide bobbingwide self-assigned this Sep 11, 2020
@bobbingwide
Copy link
Owner Author

bobbingwide commented Sep 14, 2020

Core embed blocks are now Variations of the core/embed block.
You can use getBlockVariations( state, blockName, scope ) to get the block variations by block name.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Sep 15, 2020

Requirements

The following blocks will need changing to support block variations.

  1. oik-blocks/blockicon
  2. oik-blocks/blockinfo
  3. oik-blocks/blocklist

oik-blocks/blockicon

  • The Blocks select list needs to be updated to include the Block variations.
  • The display of the icon may need updating

oik-blocks/blockinfo

  • The Blocks select list needs to be updated to include the Block variations
  • The display should list the variations ( in ascending name or title )
  • If the Show block link toggle is on each variation should link to the defined block
  • For each variation the values for the other toggles should be respected.

oik-blocks/blocklist

  • The list should include variations for each parent block with the selected prefix
  • It should no longer be necessary to create oikwp oik-create-blocks.php commands
  • The Show block description toggle can be removed

Also, the core BlockIcon should be displayed by passing icon={block.icon}. Was icon={block.icon.src}.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Sep 15, 2020

You can use getBlockVariations( state, blockName, scope ) to get the block variations by block name.

That's the theory. In practice I didn't know how to do this because I was trying to use the wrong API.

In https://developer.wordpress.org/block-editor/packages/packages-blocks/
getBlockVariations is documented as taking two parameters.

  1. blockName string: Name of block (example: “core/columns”).
  2. scope [WPBlockVariationScope]: Block variation scope name.

where scope is 'block' or 'inserter'.

In https://developer.wordpress.org/block-editor/data/data-core-blocks/ there's a different function with the same name.
This is used when working with select( 'core/blocks').
This is the stuff that I'm still struggling to understand.
Fortunately, I don't need to use this function; I just needed to use the right values for the parameters to the first.

@bobbingwide
Copy link
Owner Author

The Show block description toggle can be removed

Do two things at the same time.

  • Change the showDescription toggle to showVariations; to optionally display the Variations.
  • Add logic to filter variations when the toggle is off.
  • Don't worry about deprecation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant