Skip to content

Commit

Permalink
Create trashed events page block
Browse files Browse the repository at this point in the history
  • Loading branch information
trymebytes committed Oct 15, 2024
1 parent b4ea2e3 commit 86ed8a4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion includes/routes/event/list-trashed.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handle(): void {
// phpcs:enable

$trashed_events_query = $this->event_repository->get_trashed_events( $current_page, 10 );

$this->use_theme();
$this->tmpl(
'trashed-events',
array(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace Wporg\TranslationEvents\Theme_2024;

register_block_type(
'wporg-translate-events-2024/page-events-trashed-events',
array(
'render_callback' => function ( array $attributes ) {
add_filter(
'wporg_block_site_breadcrumbs',
function ( $breadcrumbs ): array {
return array_merge(
$breadcrumbs,
array(
array(
'title' => __( 'Deleted Translation Events', 'wporg-translate-events-2024' ),
'url' => null,
),
)
);
}
);

render_page(
__DIR__ . '/render.php',
__( 'Deleted Translation Events', 'wporg-translate-events-2024' ),
$attributes
);
},
)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace Wporg\TranslationEvents\Theme_2024;
$event_ids = $attributes['trashed_events_query'] ['event_ids'] ?? array();
$data = array(
'event_ids' => $event_ids,
'show_flag' => false,
);
?>
<!-- wp:wporg-translate-events-2024/event-list <?php echo wp_json_encode( $data ); ?> /-->
1 change: 1 addition & 0 deletions themes/wporg-translate-events-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function register_blocks(): void {
include_once __DIR__ . '/blocks/pages/events/event-create/index.php';
include_once __DIR__ . '/blocks/event-form/index.php';
include_once __DIR__ . '/blocks/pages/events/event-edit/index.php';
include_once __DIR__ . '/blocks/pages/events/trashed-events/index.php';
}

function register_patterns(): void {
Expand Down

0 comments on commit 86ed8a4

Please sign in to comment.