Skip to content

Commit eecb176

Browse files
authored
Merge pull request #175 from devgeniem/TMS-1075
TMS-1075: Redipress 2 filters
2 parents 779d8bf + 24a3418 commit eecb176

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

CHANGELOG.MD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
- TMS-1075: Redipress 2 filters
11+
1012
## [1.10.3] - 2024-09-25
1113

1214
- TMS-1071: Fix events price element class

lib/ACFController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace TMS\Theme\Taidemuseo;
44

5-
use \TMS\Theme\Base;
5+
use TMS\Theme\Base;
66
/**
77
* Class ACFController
88
*
@@ -15,8 +15,7 @@ class ACFController extends Base\ACFController implements Base\Interfaces\Contro
1515
*
1616
* @return string
1717
*/
18-
protected function get_base_dir() : string {
18+
protected function get_base_dir(): string {
1919
return __DIR__ . '/ACF';
2020
}
21-
2221
}

lib/FormatterController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ class FormatterController extends \TMS\Theme\Base\FormatterController implements
1616
*
1717
* @return void
1818
*/
19-
public function hooks() : void {
20-
add_action(
19+
public function hooks(): void {
20+
\add_action(
2121
'init',
2222
\Closure::fromCallable( [ $this, 'register_formatters' ] )
2323
);
2424

25-
add_filter( 'tms/theme/base/formatters', [ $this, 'remove_formatters' ] );
25+
\add_filter( 'tms/theme/base/formatters', [ $this, 'remove_formatters' ] );
2626
}
2727

2828
/**
2929
* Get namespace for formatter instances
3030
*
3131
* @return string
3232
*/
33-
protected function get_namespace() : string {
33+
protected function get_namespace(): string {
3434
return __NAMESPACE__;
3535
}
3636

@@ -39,7 +39,7 @@ protected function get_namespace() : string {
3939
*
4040
* @return array
4141
*/
42-
protected function get_formatter_files() : array {
42+
protected function get_formatter_files(): array {
4343
return array_diff( scandir( __DIR__ . '/Formatters' ), [ '.', '..' ] );
4444
}
4545

@@ -50,7 +50,7 @@ protected function get_formatter_files() : array {
5050
*
5151
* @return array
5252
*/
53-
public function remove_formatters( array $classes ) : array {
53+
public function remove_formatters( array $classes ): array {
5454
$formatters_to_remove = [
5555
HeroFormatter::class,
5656
];

lib/PostType/Artwork.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ public function __construct() {
6262
* @return void
6363
*/
6464
public function hooks() : void {
65-
add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 );
66-
add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 );
65+
\add_action( 'init', Closure::fromCallable( [ $this, 'register' ] ), 15 );
66+
\add_filter( 'tms/gutenberg/blocks', Closure::fromCallable( [ $this, 'allowed_blocks' ] ), 10, 1 );
6767

68-
add_filter(
68+
\add_filter(
6969
'tms/base/breadcrumbs/before_prepare',
7070
Closure::fromCallable( [ $this, 'format_single_breadcrumbs' ] ),
7171
10,
7272
3
7373
);
7474

75-
add_filter( 'redipress/schema_fields', function ( $fields ) {
75+
\add_filter( 'redipress/index/posts/schema_fields', function ( $fields ) {
7676
$fields[] = new TextField( [
7777
'name' => 'artists',
7878
'sortable' => true,
@@ -81,15 +81,15 @@ public function hooks() : void {
8181
return $fields;
8282
}, PHP_INT_MAX, 1 );
8383

84-
add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) {
84+
\add_filter( 'redipress/additional_field/artists', function ( $value, $post_id, $post ) {
8585
if ( $post->post_type === Artwork::SLUG ) {
86-
$value = get_post_meta( $post_id, 'artists', true );
86+
$value = \get_post_meta( $post_id, 'artists', true );
8787
}
8888

8989
return $value;
9090
}, 10, 3 );
9191

92-
add_filter( 'redipress/search_fields', function ( $fields ) {
92+
\add_filter( 'redipress/search_fields', function ( $fields ) {
9393
$fields[] = 'artists';
9494

9595
return $fields;

lib/PostTypeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PostTypeController extends \TMS\Theme\Base\PostTypeController implements P
1616
*
1717
* @return string
1818
*/
19-
protected function get_namespace() : string {
19+
protected function get_namespace(): string {
2020
return __NAMESPACE__;
2121
}
2222

@@ -25,7 +25,7 @@ protected function get_namespace() : string {
2525
*
2626
* @return array
2727
*/
28-
protected function get_post_type_files() : array {
28+
protected function get_post_type_files(): array {
2929
return array_diff( scandir( __DIR__ . '/PostType' ), [ '.', '..' ] );
3030
}
3131
}

lib/ThemeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ThemeController extends \TMS\Theme\Base\ThemeController {
1313
/**
1414
* Init classes
1515
*/
16-
protected function init_classes() : void {
16+
protected function init_classes(): void {
1717
$classes = [
1818
Assets::class,
1919
ACFController::class,
@@ -34,7 +34,7 @@ protected function init_classes() : void {
3434
}
3535
} );
3636

37-
add_action( 'init', function () {
37+
\add_action( 'init', function () {
3838
ArchiveExhibition::hooks();
3939
} );
4040
}

lib/autoload.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ function theme_library_loader( $class = '' ) {
3737

3838
// Register the theme autoloader.
3939
spl_autoload_register( __NAMESPACE__ . '\\theme_library_loader' );
40-

models/single-exhibition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class SingleExhibition extends BaseModel {
1313
/**
1414
* Hooks
1515
*/
16-
public function hooks() : void {
17-
add_filter( 'tms/theme/breadcrumbs/show_breadcrumbs_in_header', fn() => false );
16+
public function hooks(): void {
17+
\add_filter( 'tms/theme/breadcrumbs/show_breadcrumbs_in_header', fn() => false );
1818
}
1919

2020
/**
@@ -40,12 +40,12 @@ public function content() {
4040
* @param int $id The post ID.
4141
*/
4242
public static function get_date( $id ) {
43-
$start_date = get_field( 'start_date', $id );
43+
$start_date = \get_field( 'start_date', $id );
4444
$opening_times = '';
4545

4646
if ( ! empty( $start_date ) ) {
4747
$opening_times = self::reformat_datetime_string( $start_date );
48-
$end_date = get_field( 'end_date', $id );
48+
$end_date = \get_field( 'end_date', $id );
4949

5050
if ( ! empty( $end_date ) ) {
5151
$opening_times .= ' - ' . self::reformat_datetime_string( $end_date );

0 commit comments

Comments
 (0)