Skip to content

Commit

Permalink
Merge pull request #2 from alleyinteractive/feature/example-url-post
Browse files Browse the repository at this point in the history
Pass post to example URL filter
  • Loading branch information
dlh01 authored May 1, 2024
2 parents 5660891 + 70947e6 commit ec11c68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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

0 comments on commit ec11c68

Please sign in to comment.