td_api_smart_list::update_key

Available on: Newsmag V1.8+, Newspaper V5+
This api call is used to update only one of the parameters of an existing smart list style.

Usage:

<?php td_api_smart_list::update_key( $id, $key, $value ) ?>

Parameters:

$id (string) (required)

  • the smart list id – has to match with one of the smart lists which are already registered in the theme

$key (string) (required)

  • parameter to be replaced, in the following table you can see all parameters but only one can be used because via this method you can update only one parameter:
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

$value (mixed) (required)

  • the data which will replace the parameter existing one, it’s type depends on the selected parameter.

Examples:

In the following example we’ll update the existing Smart List 1 ,  the ‘file’ key data will be replaced, you can see how the code looks on plugin, you have to modify the file path to match with the plugin current folder, we use the variables which were introduced in the Plugin Method section, ex:

td_api_smart_list::update_key('td_smart_list_1', 'file', $this->plugin_path . '/includes/smart_lists/td_smart_list_1.php');