From 89bacfdb881bb827d4c6af3d1baf5264f2b38491 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Fri, 22 Aug 2014 11:34:38 +0200 Subject: [PATCH] Made sure main content id isn't required. Conflicts: h5p.classes.php --- h5p.classes.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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. *