103 lines
2.9 KiB
PHP
103 lines
2.9 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
/**
|
|
* Implements Wiaas Document types
|
|
*
|
|
* Class Wiaas_Documents
|
|
*/
|
|
class Wiaas_Documents {
|
|
|
|
/**
|
|
* Default available document types for wiaas
|
|
* @var array
|
|
*/
|
|
private static $available_doc_types = array(
|
|
'template_questionaire' => array(
|
|
'name' => 'Template Questionaire',
|
|
'is_special_type' => false,
|
|
),
|
|
'order_questionaire' => array(
|
|
'name' => 'Order Questionaire',
|
|
'is_special_type' => true,
|
|
),
|
|
'configuration' => array(
|
|
'name' => 'Configuration',
|
|
'is_special_type' => true,
|
|
),
|
|
'install_guide' => array(
|
|
'name' => 'Install guide',
|
|
'is_special_type' => false,
|
|
),
|
|
'customer_acceptance' => array(
|
|
'name' => 'Customer acceptance',
|
|
'is_special_type' => true,
|
|
),
|
|
'template_agreement' => array(
|
|
'name' => 'Template Agreement',
|
|
'is_special_type' => false,
|
|
),
|
|
'order_agreement' => array(
|
|
'name' => 'Order Agreement',
|
|
'is_special_type' => true,
|
|
),
|
|
'installation_protocol' => array(
|
|
'name' => 'Installation protocol',
|
|
'is_special_type' => true,
|
|
),
|
|
'statements' => array(
|
|
'name' => 'Statements',
|
|
'is_special_type' => false,
|
|
),
|
|
'customer_acceptance_template' => array(
|
|
'name' => 'Customer acceptance template',
|
|
'is_special_type' => false,
|
|
),
|
|
);
|
|
|
|
public static function init() {
|
|
add_action( 'init', array( __CLASS__, 'register_wiaas_document_types' ));
|
|
}
|
|
|
|
/**
|
|
* Registers taxonomy and default values for wiaas document types
|
|
*/
|
|
public static function register_wiaas_document_types() {
|
|
$labels = array(
|
|
'name' => _x( 'Document type', 'taxonomy general name', 'wiaas' ),
|
|
'singular_name' => _x( 'Document type', 'taxonomy singular name', 'wiaas' ),
|
|
'menu_name' => _x( 'Document types', 'Admin menu name', 'wiaas' ),
|
|
'search_items' => __( 'Search Document types', 'wiaas' ),
|
|
'all_items' => __( 'All Document types', 'wiaas' ),
|
|
'parent_item' => __( 'Parent Document type', 'wiaas' ),
|
|
'parent_item_colon' => __( 'Parent Document type:', 'wiaas' ),
|
|
'edit_item' => __( 'Edit Document type', 'wiaas' ),
|
|
'update_item' => __( 'Update Document type', 'wiaas' ),
|
|
'add_new_item' => __( 'Add New Document type', 'wiaas' ),
|
|
'new_item_name' => __( 'New Document type Name', 'wiaas' ),
|
|
);
|
|
|
|
$args = array(
|
|
'hierarchical' => false,
|
|
'label' => __( 'Document types', 'wiaas' ),
|
|
'labels' => $labels,
|
|
'show_ui' => true,
|
|
'show_admin_column' => true,
|
|
'query_var' => true,
|
|
'rewrite' => array( 'slug' => 'wiaas_document_types' ),
|
|
);
|
|
|
|
register_taxonomy( 'wiaas_document_types', array( 'attachment' ), $args );
|
|
|
|
foreach (self::$available_doc_types as $key => $available_doc_type) {
|
|
wp_insert_term($available_doc_type['name'], 'wiaas_document_types', array(
|
|
'slug' => $key
|
|
));
|
|
}
|
|
}
|
|
}
|
|
|
|
Wiaas_Documents::init(); |