Skip to content

Commit

Permalink
refine(volunteer-assignment): override post type slug for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
nRamstedt committed Jan 4, 2024
1 parent 58fd5da commit 34e4201
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/php/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function registerHooks(DIContainer $DI, PluginManager $plugin)
->register($DI->make(PostTypes\Assignment\Scripts::class))
->register($DI->make(PostTypes\Assignment\PreventAlgolia::class))
->register($DI->make(PostTypes\Assignment\PreventRobots::class))
->register($DI->make(PostTypes\Assignment\OverridePostTypeSlug::class))
->register($DI->make(PostTypes\Assignment\Controller\Single::class));
}
}
22 changes: 22 additions & 0 deletions source/php/PostTypes/Assignment/OverridePostTypeSlug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace APIVolunteerManagerIntegration\PostTypes\Assignment;

use APIVolunteerManagerIntegration\Helper\PluginManager\FilterHookSubscriber;

class OverridePostTypeSlug implements FilterHookSubscriber
{
public function changePostTypeSlug(array $args, string $postType): array
{
if ($postType === 'vol-assignment') {
$args['rewrite']['slug'] = 'volontaruppdrag';
}

return $args;
}

public static function addFilters(): array
{
return [['register_post_type_args', 'changePostTypeSlug', 10, 2]];
}
}

0 comments on commit 34e4201

Please sign in to comment.