From 2844045d908c3322c1aff6d818ca360a0a850047 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 19 Mar 2019 16:03:52 -0600 Subject: [PATCH] Get changes showing up for admin_cmd_category --- admin/inc/class.admin_cmd_category.inc.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/admin/inc/class.admin_cmd_category.inc.php b/admin/inc/class.admin_cmd_category.inc.php index 90151375c5..904eb3e64a 100644 --- a/admin/inc/class.admin_cmd_category.inc.php +++ b/admin/inc/class.admin_cmd_category.inc.php @@ -107,4 +107,51 @@ class admin_cmd_category extends admin_cmd $this->old ? lang('edited') : lang('added') ); } + + /** + * Get name of eTemplate used to make the change to derive UI for history + * + * @return string|null etemplate name + */ + protected function get_etemplate_name() + { + return 'admin.categories.edit'; + } + + + /** + * Return (human readable) labels for keys of changes + * + * @return array + */ + function get_change_labels() + { + $labels = parent::get_change_labels(); + // Never seems to be in old value, so don't show it + $labels['icon_url'] = False; + // Just for internal use, no need to show it + $labels['main'] = False; + + return $labels; + } + + /** + * Return widget types (indexed by field key) for changes + * + * Used by historylog widget to show the changes the command recorded. + */ + function get_change_widgets() + { + $widgets = parent::get_change_widgets(); + unset($widgets['data[icon]']); + $widgets['data'] = array( + // Categories have non-standard image location, so image widget can't find them + // without being given the full path, which we don't have + 'icon' => 'description', + 'color' => 'colorpicker' + ); + $widgets['parent'] = 'select-cat'; + $widgets['owner'] = 'select-account'; + return $widgets; + } }