post_type !== Constants::POST_TYPE_PLACEMENT ) { return null; } return new Placement( $source ); } /** * Create a virtual Placement. * * @param string $item_type * @param int $item_id * * @return Placement */ public static function make_virtual( string $item_type, int $item_id ): Placement { $virtual_data = [ 'placement_item_id' => $item_id, 'type' => 'manual', // translators: %1$s is the placement item type; %2$s is the placement item ID. 'title' => sprintf( __( 'Block: %1$1s %2$2d', 'adpresso' ), ucfirst( $item_type ), $item_id ), 'id' => '999999', // Use a high ID to avoid conflicts ]; return new Placement( null, $virtual_data ); } }