Developer Docs for EazyDocs
How to add custom tab in Assistant?
The EazyDocs Assistant allows users to add their custom tabs and content easily. Here I have explained how to to use the hook and display a custom tab into the EazyDocs Assistant.
Hook Details
- Hook Name:
eazydocs_assistant_tab
- Parameters: None
- Return Type: Array – An array containing all custom tabs and their corresponding content.
How to Use
Adding Custom Tabs:To add custom tabs and content, users can utilize the add_action
function with the eazydocs_assistant_tab
hook. This hook expects a callback function that adds custom tabs and their respective content to the returned array
add_action( 'eazydocs_assistant_tab', 'my_custom_tab' );
function my_custom_tab( $tabs = [] ){
$tabs[] = array(
'id' => 'my-tab',
'heading' => 'Custom Tab',
'content' => 'This is custom content' // Or any callback function
);
return $tabs;
}, 10);
- Structure of Custom Tab Array:
- Each custom tab is represented by an associative array with the following keys:
id
: A unique identifier for the tab.heading
: The title or heading of the tab.content
: The content to be displayed within the tab. Users can use static content or callback functions to display their content dynamically for the specified tab of the EazyDocs Assistant.
- Adding Additional Tabs: Users can add as many custom tabs as needed by appending more arrays to the
$tabs
array within the callback function. - Displaying Custom Tabs: Once custom tabs have been added using the
eazydocs_assistant_tab
hook, they will be automatically displayed within the EazyDocs Assistant.