You appear to be a bot. Output may be restricted
Description
Register custom post type: oik_apiMetadata fields:
- Do not include syntax since this is determined programmatically
- It should be possible to augment the documentation for an API if we know the particular type
- It should not be necessary to document the number of parameters needed for an action or filter since
- this should be obvious from the prototype
- BUT someone might want to specify the expected priority in the body
- _oik_api_hooks is a serialized structure that is not exposed to the end user. Herb 2013/10/23
- 2014/07/08 We no longer register _oik_api_example or _oik_api_notes – if required these should be created as separate post types
- oik_api_source has become redundant
Usage
oik_register_API();
Parameters
Returns
voidSource
File name: oik-shortcodes/oik-shortcodes.phpLines:
1 to 40 of 40
function oik_register_API() { $post_type = 'oik_api'; $post_type_args = array(); $post_type_args['label'] = 'APIs'; $post_type_args['description'] = 'Application Programming Interfaces'; $post_type_args['supports'] = array( 'title', 'editor', 'revisions', 'author' ); $post_type_args['has_archive'] = true; $post_type_args['show_in_rest'] = true; bw_register_post_type( $post_type, $post_type_args ); bw_register_field( "_oik_api_name", "text", "Function name" , array( "#length" => 80 )); bw_register_field( "_oik_api_class", "noderef", "Class ref", array( "#type" => "oik_class", "#optional" => true, '#theme_null' => false )); bw_register_field( "_oik_api_plugin", "noderef", "Plugin ref", array( "#type" => array( "oik-plugins", "oik-themes" ) )); bw_register_field( "_oik_api_source", "text", "Sourcefile" , array( "#length" => 80 )); bw_register_field( "_oik_fileref", "noderef", "File ref", array( "#type" => "oik_file" )); bw_register_field( "_oik_api_type", "select", "API type", array( "#options" => oiksc_api_types(), "#optional" => true, '#theme_null' => false ) ); //bw_register_field( "_oik_api_example", "textarea", "Examples", array( '#theme' => false, '#form' => false ) ); //bw_register_field( "_oik_api_notes", "textarea", "Notes", array( '#theme' => false, '#form' => false ) ); bw_register_field( "_oik_api_deprecated_cb", "checkbox", "Deprecated?" ); //bw_register_field( "_oik_api_calls", "noderef", "Uses APIs", array( "#type" => "oik_api", "#multiple" => true, "#optional" => true, '#theme' => false )); //bw_register_field( "_oik_api_hooks", "noderef", "Uses hooks", array( "#type" => "oik_hook", "#multiple" => true, "#optional" => true, '#theme' => false )); bw_register_field_for_object_type( "_oik_api_name", $post_type ); bw_register_field_for_object_type( "_oik_api_class", $post_type ); bw_register_field_for_object_type( "_oik_api_plugin", $post_type ); bw_register_field_for_object_type( "_component_version", $post_type ); bw_register_field_for_object_type( "_oik_api_source", $post_type ); bw_register_field_for_object_type( "_oik_fileref", $post_type ); bw_register_field_for_object_type( "_oik_api_type", $post_type ); //bw_register_field_for_object_type( "_oik_api_example", $post_type ); //bw_register_field_for_object_type( "_oik_api_notes", $post_type ); bw_register_field_for_object_type( "_oik_api_deprecated_cb", $post_type ); bw_register_field_for_object_type( "_oik_api_calls", $post_type ); bw_register_field_for_object_type( "_oik_api_hooks", $post_type ); if ( function_exists( "oikp_columns_and_titles" ) ) { oikp_columns_and_titles( $post_type ); } }View on GitHub