<?php

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! defined( 'CPTUI_VERSION' ) ) {
	return;
}

if ( ! class_exists( 'PWBE_CPTUI' ) ) :

final class PWBE_CPTUI {

	function __construct() {
        add_filter( 'pwbe_custom_taxonomies', array( $this, 'pwbe_custom_taxonomies' ) );
	}

    function pwbe_custom_taxonomies( $custom_taxonomies ) {
        if ( function_exists( 'cptui_get_taxonomy_data' ) ) {
            $taxonomies = cptui_get_taxonomy_data();

            foreach ( $taxonomies as $slug => $tax ) {
                $custom_taxonomies[] = array( 'slug' => $slug, 'name' => $tax['singular_label'], 'plural' => $slug . 's' );
            }
        }

        return $custom_taxonomies;
    }
}

new PWBE_CPTUI();

endif;
