wpseek.com
A WordPress-centric search engine for devs and theme authors
_get_custom_object_labels is private and should not be used in themes or plugins directly.
_get_custom_object_labels › WordPress Function
Since3.0.0
Deprecatedn/a
› _get_custom_object_labels ( $data_object, $nohier_vs_hier_defaults )
Access: |
|
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object
Related Functions: get_post_type_labels, wp_get_custom_css, get_custom_header, get_taxonomy_labels, wp_get_object_terms
Source
function _get_custom_object_labels( $data_object, $nohier_vs_hier_defaults ) { $data_object->labels = (array) $data_object->labels; if ( isset( $data_object->label ) && empty( $data_object->labels['name'] ) ) { $data_object->labels['name'] = $data_object->label; } if ( ! isset( $data_object->labels['singular_name'] ) && isset( $data_object->labels['name'] ) ) { $data_object->labels['singular_name'] = $data_object->labels['name']; } if ( ! isset( $data_object->labels['name_admin_bar'] ) ) { $data_object->labels['name_admin_bar'] = isset( $data_object->labels['singular_name'] ) ? $data_object->labels['singular_name'] : $data_object->name; } if ( ! isset( $data_object->labels['menu_name'] ) && isset( $data_object->labels['name'] ) ) { $data_object->labels['menu_name'] = $data_object->labels['name']; } if ( ! isset( $data_object->labels['all_items'] ) && isset( $data_object->labels['menu_name'] ) ) { $data_object->labels['all_items'] = $data_object->labels['menu_name']; } if ( ! isset( $data_object->labels['archives'] ) && isset( $data_object->labels['all_items'] ) ) { $data_object->labels['archives'] = $data_object->labels['all_items']; } $defaults = array(); foreach ( $nohier_vs_hier_defaults as $key => $value ) { $defaults[ $key ] = $data_object->hierarchical ? $value[1] : $value[0]; } $labels = array_merge( $defaults, $data_object->labels ); $data_object->labels = (object) $data_object->labels; return (object) $labels; }