API – Smart Lists – Introduction

Available on: Newspaper V11+

The td_api_smart_list class allows you to add or modify a smart list. In the following image you can see how Smart List – Style 1 looks in the frontend :

td_api_smart_list_frontend

 

The theme smart lists are registered in td-composer/legacy/Newspaper/includes/td_config.php, the code looks like this:

td_api_smart_list::add('td_smart_list_1',
    array(
        'file' => TDC_PATH_LEGACY . '/includes/smart_lists/td_smart_list_1.php',
        'text' => 'Smart list 1',
        'img' => TDC_URL_LEGACY . '/assets/images/panel/smart_lists/td_smart_list_1.png',
        'extract_first_image' => true,
        'group' => '', // '' - main theme, 'mob' - mobile theme, 'woo' - woo theme
    )
);

Parameters:

$id (string) (required)

  • the smart list id – if you add a new smart list style the id has to be different from the ones used on the other smart list styles which are registered in theme, if you plan to modify one of the existing smart list styles 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 smart list style:
Key name
Type
Description
file string the path for the smart list template file
text string the title, it appears on post editing -> Smart List section
img string the smart list icon, it appears on post editing -> Smart List section