diff --git a/h5p.classes.php b/h5p.classes.php index 088d4c2..fbcf3f5 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1278,6 +1278,25 @@ class H5PCore { } } + /** + * Save content and clear cache. + * + * @param array $content + * @return int Content ID + */ + public function saveContent($content, $contentMainId = NULL) { + if (isset($content['id'])) { + $this->h5pF->updateContent($content, $contentMainId); + } + else { + $content['id'] = $this->h5pF->insertContent($content, $contentMainId); + } + + $this->h5pF->cacheDel('parameters', $content['id']); + + return $content['id']; + } + /** * Load content. *