<?php


// register the dragBlock form entry type
add_action('init', 'dragblock_register_post_type_form_entries');
function dragblock_register_post_type_form_entries()
{
	$labels = array(
		'name'                  => __('DragBlock Form Entries', 'dragblock'),
		'singular_name'         => __('DragBlock Form Entry', 'dragblock'),
		'menu_name'             => __('Block Form Entry', 'dragblock'),
		'name_admin_bar'        => __('Block Form Entry', 'dragblock'),
		'add_new'               => __('Add New', 'dragblock'),
		'add_new_item'          => __('Add New DragBlock Form Entry', 'dragblock'),
		'new_item'              => __('New DragBlock Form Entry', 'dragblock'),
		'edit_item'             => __('Edit DragBlock Form Entry', 'dragblock'),
		'view_item'             => __('View DragBlock Form Entry', 'dragblock'),
		'all_items'             => __('All DragBlock Forms', 'dragblock'),
		'search_items'          => __('Search DragBlock Forms', 'dragblock'),
		'parent_item_colon'     => __('Parent DragBlock Forms:', 'dragblock'),
		'not_found'             => __('No DragBlock Forms found.', 'dragblock'),
		'not_found_in_trash'    => __('No DragBlock Forms found in Trash.', 'dragblock'),
		'archives'              => __('DragBlock Form Archives', 'dragblock'),
		'attributes'            => __('DragBlock Form Attributes', 'dragblock'),
		'insert_into_item'      => __('Insert into DragBlock Form', 'dragblock'),
		'uploaded_to_this_item' => __('Uploaded to this DragBlock Form', 'dragblock'),
		'featured_image'        => __('Featured Image', 'dragblock'),
		'set_featured_image'    => __('Set featured image', 'dragblock'),
		'remove_featured_image' => __('Remove featured image', 'dragblock'),
		'use_featured_image'    => __('Use as featured image', 'dragblock'),
		'filter_items_list'     => __('Filter DragBlock Forms list', 'dragblock'),
		'items_list_navigation' => __('DragBlock Forms list navigation', 'dragblock'),
		'items_list'            => __('DragBlock Forms list', 'dragblock'),
	);

	$args = array(
		'labels'              => $labels,
		'public'              => false,
		'publicly_queryable'  => false,
		'show_ui'             => true,
		'show_in_menu'        => false,
		'query_var'           => true,
		'rewrite'             => array('slug' => DRAGBLOCK_FORM_ENTRY),
		// 'capability_type' => 'no_add_new', // set custom capability type
		// 'capabilities' => array(
		// 	'edit_post' => 'edit_' . DRAGBLOCK_FORM_ENTRY,
		// 	'read_post' => 'read_' . DRAGBLOCK_FORM_ENTRY,
		// 	'delete_post' => 'delete_' . DRAGBLOCK_FORM_ENTRY,
		// 	'edit_posts' => 'edit_' . DRAGBLOCK_FORM_ENTRY . 's',
		// 	'edit_others_posts' => 'edit_others_' . DRAGBLOCK_FORM_ENTRY . 's',
		// 	'publish_posts' => 'publish_' . DRAGBLOCK_FORM_ENTRY . 's',
		// 	'read_private_posts' => 'read_private_' . DRAGBLOCK_FORM_ENTRY . 's',
		// 	'create_posts' => false, // prevent creating new items
		// ),
		'has_archive'         => true,
		'hierarchical'        => false,
		'menu_position'       => 1,
		'supports'            => array('title', 'editor', 'custom-fields'),
		'menu_icon'           => 'dashicons-email',
		'show_in_rest'        => false, // exclude from rest api, including block editor
		'exclude_from_search' => true,
	);

	register_post_type(DRAGBLOCK_FORM_ENTRY, $args);
}
