<?php
/**
 * File Path: includes/taxonomies/class-mbs-taxonomy-content-warning.php
 *
 * Content Warning Taxonomy
 *
 * Flat (non-hierarchical) taxonomy for content advisories attached to books
 * (graphic violence, substance abuse, etc.). Ships with a curated standard
 * list seeded by MBS_Content_Warning_Seeder; admins may add free terms via
 * the WP taxonomy admin screen.
 *
 * Assignment in the book editor is handled by the shared MBS_Metabox_Categorization
 * panel (Tags | Themes | Warnings tabs). The default WP tag-style sidebar
 * metabox is suppressed by that class.
 *
 * show_in_menu is false; MBS_Admin::add_menu() registers any desired submenu
 * manually (MENU-01 pattern).
 *
 * @package    My_Book_Showroom
 * @subpackage Includes/Taxonomies
 * @since      1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class MBS_Taxonomy_Content_Warning {

	public static function register(): void {
		$labels = array(
			'name'                       => __( 'Content Warnings', 'my-book-showroom' ),
			'singular_name'              => __( 'Content Warning', 'my-book-showroom' ),
			'menu_name'                  => __( 'Content Warnings', 'my-book-showroom' ),
			'search_items'               => __( 'Search Content Warnings', 'my-book-showroom' ),
			'popular_items'              => __( 'Popular Warnings', 'my-book-showroom' ),
			'all_items'                  => __( 'All Content Warnings', 'my-book-showroom' ),
			'edit_item'                  => __( 'Edit Content Warning', 'my-book-showroom' ),
			'update_item'                => __( 'Update Content Warning', 'my-book-showroom' ),
			'add_new_item'               => __( 'Add New Content Warning', 'my-book-showroom' ),
			'new_item_name'              => __( 'New Content Warning Name', 'my-book-showroom' ),
			'separate_items_with_commas' => __( 'Separate warnings with commas', 'my-book-showroom' ),
			'add_or_remove_items'        => __( 'Add or remove warnings', 'my-book-showroom' ),
			'choose_from_most_used'      => __( 'Choose from the most used warnings', 'my-book-showroom' ),
			'not_found'                  => __( 'No content warnings found.', 'my-book-showroom' ),
		);

		register_taxonomy(
			MBS_TAX_CONTENT_WARNING,
			MBS_POST_TYPE,
			array(
				'labels'            => $labels,
				'hierarchical'      => false,
				'public'            => true,
				'show_ui'           => true,
				'show_in_rest'      => true,
				'show_admin_column' => false,
				'rewrite'           => array( 'slug' => 'book-content-warning' ),
				// MENU-01: Prevent auto-attachment to edit.php?post_type=mbs_book.
				'show_in_menu'      => false,
				'show_in_quick_edit' => false,
			)
		);
	}
}
