From d3ded3404f4d29fd784e619b7c1cf732bf831322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20V=C3=A4nttinen?= Date: Thu, 10 Oct 2024 14:49:07 +0300 Subject: [PATCH] TMS-1075: Redipress 2 filters --- CHANGELOG.MD | 2 ++ lib/PostType/Artwork.php | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index c3ad516..a4bcce0 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- TMS-1075: Redipress 2 filters + ## [1.10.3] - 2024-09-25 - TMS-1071: Fix events price element class diff --git a/lib/PostType/Artwork.php b/lib/PostType/Artwork.php index 997dddd..4500ef5 100644 --- a/lib/PostType/Artwork.php +++ b/lib/PostType/Artwork.php @@ -62,17 +62,17 @@ public function __construct() { * @return void */ public function hooks() : void { - add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 ); - add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 ); + \add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 ); + \add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 ); - add_filter( + \add_filter( 'tms/base/breadcrumbs/before_prepare', Closure::fromCallable( [ $this, 'format_single_breadcrumbs' ] ), 10, 3 ); - add_filter( 'redipress/schema_fields', function ( $fields ) { + \add_filter( 'redipress/index/posts/schema_fields', function ( $fields ) { $fields[] = new TextField( [ 'name' => 'artists', 'sortable' => true, @@ -81,15 +81,15 @@ public function hooks() : void { return $fields; }, PHP_INT_MAX, 1 ); - add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) { + \add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) { if ( $post->post_type === Artwork::SLUG ) { - $value = get_post_meta( $post_id, 'artists', true ); + $value = \get_post_meta( $post_id, 'artists', true ); } return $value; }, 10, 3 ); - add_filter( 'redipress/search_fields', function ( $fields ) { + \add_filter( 'redipress/search_fields', function ( $fields ) { $fields[] = 'artists'; return $fields;