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

Block Hooks API: Update Template Part block for first and last child hooked blocks #62732

Conversation

tjcafferkey
Copy link
Contributor

@tjcafferkey tjcafferkey commented Jun 21, 2024

Trac ticket: https://core.trac.wordpress.org/ticket/60854

What?

This is a proof of concept exploring various ways to allow insertion of first_child and last_child insertions of hooked blocks into template parts. You can find another approach here WordPress/wordpress-develop#6867

Why?

Currently inserting hooked blocks as first_child and last_child is not possible

How?

Testing Instructions

Testing Instructions for Keyboard

function register_logout_block_as_hooked_block( $hooked_blocks, $position, $anchor_block, $context ) {
	if ( 'core/template-part' === $anchor_block && 'first_child' === $position ) {
		$hooked_blocks[] = 'core/loginout';
	}

	return $hooked_blocks;
}

add_filter( 'hooked_block_types', 'register_logout_block_as_hooked_block', 10, 4 );

Screenshots or screencast

@tjcafferkey tjcafferkey added [Status] In Progress Tracking issues with work in progress [Block] Template Part Affects the Template Parts Block [Feature] Block hooks labels Jun 21, 2024
@tjcafferkey tjcafferkey self-assigned this Jun 21, 2024
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: [Status] In Progress, [Block] Template Part, [Feature] Block hooks.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@tjcafferkey tjcafferkey requested a review from ockham June 21, 2024 10:20
@tjcafferkey
Copy link
Contributor Author

@tjcafferkey tjcafferkey closed this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Block hooks [Status] In Progress Tracking issues with work in progress
1 participant