Settings Tab Integration #
New in v1.2.0
Extensions can add their own tab to the DDLS Settings section using three hooks: one to register the tab, one to render its content, and one to handle saving.
Step 1: Register the Tab #
Use the dmsilm_settings_tabs filter to add your tab to the Settings Column 2 list:
add_filter( 'dmsilm_settings_tabs', function( $tabs ) {
$tabs[] = array(
'slug' => 'my-ext-settings',
'label' => 'My Extension',
'order' => 50,
);
return $tabs;
} );
The slug value is used in the URL (&view=my-ext-settings) and in the two action hooks below.
Step 2: Render Tab Content #
Use the dmsilm_settings_tab_content_{slug} action to output your tab’s HTML form:
add_action( 'dmsilm_settings_tab_content_my-ext-settings', function() {
$option = get_option( 'my_ext_api_key', '' );
?>
<table class="form-table">
<tr>
<th><label for="my-ext-api-key">API Key</label></th>
<td>
<input type="text"
id="my-ext-api-key"
name="my_ext_api_key"
value="<?php echo esc_attr( $option ); ?>"
class="regular-text" />
</td>
</tr>
</table>
<?php
} );
Core wraps your content in a
