-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Harmony video events (#14)
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Retain the last six months of `pmc_event_video` objects and their associated data. | ||
* | ||
* @package pmc-wp-local-data-cli | ||
*/ | ||
|
||
declare( strict_types = 1 ); | ||
|
||
namespace PMC\WP_Local_Data_CLI\Query_Args; | ||
|
||
use PMC\Harmony_Companion\Event_Video; | ||
use PMC\WP_Local_Data_CLI\Query_Args; | ||
|
||
/** | ||
* Class PMC_Harmony_Companion. | ||
*/ | ||
final class PMC_Harmony_Companion extends Query_Args { | ||
/** | ||
* Build array of `WP_Query` arguments used to retrieve IDs to retain. | ||
* | ||
* @return array | ||
*/ | ||
public static function get_query_args(): array { | ||
return [ | ||
'post_type' => Event_Video::POST_TYPE_NAME, | ||
'date_query' => [ | ||
[ | ||
'after' => '-6 months', | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Process dependent data associated with a given ID, such as a post's | ||
* thumbnail. | ||
* | ||
* If post type has no dependent data, set `static::$find_linked_ids` to | ||
* false to skip this method. | ||
* | ||
* @param int $id Post ID. | ||
* @param string $post_type Post type of given ID. | ||
* @return array | ||
*/ | ||
// Declaration must be compatible with overridden method. | ||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed, Squiz.Commenting.FunctionComment.Missing, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | ||
public static function get_linked_ids( int $id, string $post_type ): array { | ||
$ids = []; | ||
|
||
self::_add_thumbnail_id( $ids, $id ); | ||
|
||
return $ids; | ||
} | ||
} |