diff options
author | diosmosis <benaka@piwik.pro> | 2014-11-13 12:45:05 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-11-13 12:45:05 +0300 |
commit | e596b71231113941b43809e0adc9af608e797645 (patch) | |
tree | bbe492d166839be95976eed16c965786d9084f42 /core/DataTable.php | |
parent | d07d24c59780587c58727a5295951a2dfcb8fc58 (diff) |
Move goal translations and metric docs to metric classes from Goals visualization. Allow these values as defaults for translations in visualizations, and fix a bug in GoalsTable where sort was improperly applied if no data was in the data table. Also include in-memory caching for Goals.getGoals API method.
Diffstat (limited to 'core/DataTable.php')
-rw-r--r-- | core/DataTable.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/DataTable.php b/core/DataTable.php index 16839631e5..bdb7ef4f99 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -1679,4 +1679,21 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess { $this->deleteRow($offset); } -} + + /** + * Returns the ID of the site a table is related to based on the 'site' metadata entry, + * or null if there is none. + * + * @param DataTable $table + * @return int|null + */ + public static function getSiteIdFromMetadata(DataTable $table) + { + $site = $table->getMetadata('site'); + if (empty($site)) { + return null; + } else { + return $site->getId(); + } + } +}
\ No newline at end of file |