/**
* Register the labels used for this post_type.
*
* @param array $args
*
* @return object
*/
static function register_post_type_labels($args = array())
{
if (!isset($args['name'])) {
/**
* @future Add an error message here. But, this should never happen unless developer screws up.
*/
$args['name'] = null;
$labels = $args;
} else {
/*
* Provide default values for each of the 3 other templates that are just singular or plural name,
* and for 'add_new' which does not apply the post name.
*/
$args = wp_parse_args($args, array('singular_name' => $args['name'], 'menu_name' => $args['name'], 'name_admin_bar' => $args['name'], 'add_new' => _x('Add New', 'post type', 'wplib')));
/*
* Get the label templates defaults.
*/
$labels = WPLib_Posts::default_post_type_labels();
/**
* Now apply the postname to the defaults and merge with the registered $args
*/
$labels = wp_parse_args($args, array('add_new_item' => sprintf($labels['add_new_item'], $args['singular_name']), 'new_item' => sprintf($labels['new_item'], $args['singular_name']), 'edit_item' => sprintf($labels['edit_item'], $args['singular_name']), 'view_item' => sprintf($labels['view_item'], $args['singular_name']), 'all_items' => sprintf($labels['all_items'], $args['name']), 'search_items' => sprintf($labels['search_items'], $args['name']), 'parent_item_colon' => sprintf($labels['parent_item_colon'], $args['singular_name']), 'not_found' => sprintf($labels['not_found'], $args['name']), 'not_found_in_trash' => sprintf($labels['not_found_in_trash'], $args['name'])));
/**
* For the calling class, merge the templates and with the singular and plural post type names.
*/
$labels = wp_parse_args($args, $labels);
WPLib_Posts::_set_post_type_labels(static::POST_TYPE, $labels);
}
return $labels;
}