diff options
author | sgiehl <stefan@piwik.org> | 2017-06-02 21:10:38 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2017-06-02 21:10:38 +0300 |
commit | 50fd8218fe2e9bf7fd0be0bd71b8fd17938b472a (patch) | |
tree | 958422e9d4a593d3aee970605094221b8be1cc40 /plugins/DevicePlugins | |
parent | 63822866fee1b8b566fa45ee3117593846aab75c (diff) |
make it possible to set icons for custom device plugin columns
Diffstat (limited to 'plugins/DevicePlugins')
-rw-r--r-- | plugins/DevicePlugins/Columns/DevicePluginColumn.php | 4 | ||||
-rw-r--r-- | plugins/DevicePlugins/functions.php | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/plugins/DevicePlugins/Columns/DevicePluginColumn.php b/plugins/DevicePlugins/Columns/DevicePluginColumn.php index a7759f1ff8..9dc34ac569 100644 --- a/plugins/DevicePlugins/Columns/DevicePluginColumn.php +++ b/plugins/DevicePlugins/Columns/DevicePluginColumn.php @@ -19,7 +19,7 @@ abstract class DevicePluginColumn extends VisitDimension { /** * Can be overwritten by Columns in other plugins to - * set a custom plugin not included in Piwik Core + * set a custom icon not included in Piwik Core */ public $columnIcon = null; -}
\ No newline at end of file +} diff --git a/plugins/DevicePlugins/functions.php b/plugins/DevicePlugins/functions.php index 30a6cf504b..020736a89e 100644 --- a/plugins/DevicePlugins/functions.php +++ b/plugins/DevicePlugins/functions.php @@ -16,5 +16,20 @@ function getPluginsLogo($label) if ($label == Piwik::translate('General_Others')) { return false; } - return 'plugins/Morpheus/icons/dist/plugins/' . $label . '.png'; + $icon = 'plugins/Morpheus/icons/dist/plugins/' . $label . '.png'; + + if (file_exists(PIWIK_INCLUDE_PATH . '/' . $icon)) { + return $icon; + } + + // try to use column icon defined in Column class + $columns = DevicePlugins::getAllPluginColumns(); + + foreach ($columns as $column) { + if (strtolower($label) == substr($column->getColumnName(), 7) && $column->columnIcon) { + return $column->columnIcon; + } + } + + return false; } |