Skip to content

Commit

Permalink
Updated Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget committed Dec 18, 2023
1 parent 5bf34c8 commit f56bf2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client-mu-plugins/goodbids/src/classes/Frontend/Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function register_patterns(): void {
function (): void {
// Register the GoodBids Pattern Category.
register_block_pattern_category(
'goodbids',
self::DEFAULT_NAMESPACE,
[
'label' => __( 'GoodBids', 'goodbids' ),
]
Expand Down Expand Up @@ -103,6 +103,10 @@ public function register_pattern( array $pattern ): bool {
return false;
}

if ( empty( $pattern['categories'] ) ) {
$pattern['categories'] = [ self::DEFAULT_NAMESPACE ];
}

if ( 'php' === $extension ) {
ob_start();
include $path;
Expand Down
21 changes: 21 additions & 0 deletions docs/hooks/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,24 @@ add_filter(
}
);
```
### goodbids_block_patterns

Registers custom block patterns.

```php
add_filter(
'goodbids_block_patterns',
function ( array $patterns ): array {
$theme_patterns = [
[
'name' => 'goodbids-np/my-pattern',
'path' => get_stylesheet_directory() . '/patterns/my-pattern.php',
'title' => __( 'My Pattern', 'goodbids-nonprofit' ),
'source' => 'theme',
'inserter' => true,
]
];

return array_merge( $patterns, $theme_patterns );
}
```

0 comments on commit f56bf2e

Please sign in to comment.