Skip to content

Commit

Permalink
Merge branch 'main' into FAU-448
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyian committed Dec 26, 2024
2 parents fe10743 + 97b104c commit 43d69ad
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Infrastructure/Content/Taxonomy/Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ final public static function hidden(): static
);
}

final public static function editableOnly(): static
{
return self::default()->merge(
[
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_in_rest' => true,
'meta_box_cb' => false,
]
);
}

final public function args(): array
{
return $this->args;
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/Content/TaxonomyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ public function testTaxonomyArgGeneration(): void
DegreeTaxonomy::public()->args()
);

$this->assertSame(
[
'label' => 'Degrees',
'labels' => $expectedLabels,
'hierarchical' => true,
'rest_base' => 'degree',
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_in_rest' => true,
'meta_box_cb' => false,
],
DegreeTaxonomy::editableOnly()->args()
);

$this->assertSame(
[
'label' => 'Degrees',
Expand Down

0 comments on commit 43d69ad

Please sign in to comment.