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

Pass post to example URL filter #2

Merged
merged 3 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/).

## 1.1.0

### Changed

- The post object is now passed to the `alley_block_audit_block_type_example_url` filter.

## 1.0.0

Initial release.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "^8.1",
"alleyinteractive/composer-wordpress-autoloader": "^1.0",
"alleyinteractive/wp-bulk-task": "dev-main",
"alleyinteractive/wp-bulk-task": "^0.2",
"alleyinteractive/wp-match-blocks": "^3.0",
"alleyinteractive/wp-type-extensions": "^2.1"
},
Expand Down
4 changes: 3 additions & 1 deletion src/features/class-block-audit-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Alley\WP_Bulk_Task\Progress\Null_Progress_Bar;
use Alley\WP_Bulk_Task\Progress\PHP_CLI_Progress_Bar;
use WP_CLI;
use WP_Post;

use function Alley\WP\match_blocks;
use function WP_CLI\Utils\format_items;
Expand Down Expand Up @@ -167,8 +168,9 @@ function ( \WP_Post $post ) use ( &$out ) {
* Filters the example URL included for a block type.
*
* @param string $example_url The example URL. Defaults to the permalink of the post where the block type was first seen.
* @param WP_Post $post The post used to generate the example URL.
*/
$example_url = apply_filters( 'alley_block_audit_block_type_example_url', get_permalink( $post ) );
$example_url = apply_filters( 'alley_block_audit_block_type_example_url', get_permalink( $post ), $post );

$out[ $block_name ] = [
'Block Name' => $block_name,
Expand Down