API – Top Bar Template – Introduction

Available on: Newsmag V1.8+, Newspaper V5+
The td_api_top_bar_template class allows you to add or modify a top bar template. The theme default top bar looks like this:

td_api_top_bar_frontend

The top bar template can be changed from Theme Panel -> Header -> Top Bar section, if you use the api to add a new top bar template it will appear like this:

td_api_top_bar_new_backend

The theme top bar templates are registered in td_config.php, the code looks like this:

td_api_top_bar_template::add('td_top_bar_template_1',
    array(
        'img' => TDC_URL_LEGACY . '/assets/images/panel/top_bar_templates/icon-top-bar-1.png',
        'file' => TDC_PATH_LEGACY . '/parts/header/td_top_bar_template_1.php',
        'text' => 'Style 1'
    )
);

Parameters:

$id (string) (required)

  • the top bar template id – if you add a new top bar template the id has to be different from the ones used on the other top bar templates which are registered in theme, if you plan to modify one of the existing top bar template the id has to match with the one you’re planing to modify.

$params_array (array) (required)

  • an array which contains the parameters of the top bar template:
Key name
Type
Description
img string the top bar template icon, appears in Theme Panel -> Header section
file string the path of the top bar template file