Merge branch 'language-switcher'

pull/58/head
Frode Petterson 2019-02-22 09:36:56 +01:00
commit d3b5b07669
2 changed files with 11 additions and 1 deletions

View File

@ -40,6 +40,10 @@ abstract class H5PMetadata {
), ),
'yearTo' => array( 'yearTo' => array(
'type' => 'int' 'type' => 'int'
),
'defaultLanguage' => array(
'type' => 'text',
'maxLength' => 32,
) )
); );
@ -61,6 +65,7 @@ abstract class H5PMetadata {
',"yearFrom":' . (isset($content->year_from) ? $content->year_from : 'null') . ',"yearFrom":' . (isset($content->year_from) ? $content->year_from : 'null') .
',"yearTo":' . (isset($content->year_to) ? $content->year_to : 'null') . ',"yearTo":' . (isset($content->year_to) ? $content->year_to : 'null') .
',"changes":' . (isset($content->changes) ? $content->changes : 'null') . ',"changes":' . (isset($content->changes) ? $content->changes : 'null') .
',"defaultLanguage":' . (isset($content->default_language) ? $content->default_language : 'null') .
',"authorComments":' . (isset($content->author_comments) ? json_encode($content->author_comments) : 'null') . '}'; ',"authorComments":' . (isset($content->author_comments) ? json_encode($content->author_comments) : 'null') . '}';
} }

View File

@ -1671,7 +1671,7 @@ Class H5PExport {
'embedTypes' => $embedTypes 'embedTypes' => $embedTypes
); );
foreach(array('authors', 'source', 'license', 'licenseVersion', 'licenseExtras' ,'yearFrom', 'yearTo', 'changes', 'authorComments') as $field) { foreach(array('authors', 'source', 'license', 'licenseVersion', 'licenseExtras' ,'yearFrom', 'yearTo', 'changes', 'authorComments', 'defaultLanguage') as $field) {
if (isset($content['metadata'][$field]) && $content['metadata'][$field] !== '') { if (isset($content['metadata'][$field]) && $content['metadata'][$field] !== '') {
if (($field !== 'authors' && $field !== 'changes') || (count($content['metadata'][$field]) > 0)) { if (($field !== 'authors' && $field !== 'changes') || (count($content['metadata'][$field]) > 0)) {
$h5pJson[$field] = json_decode(json_encode($content['metadata'][$field], TRUE)); $h5pJson[$field] = json_decode(json_encode($content['metadata'][$field], TRUE));
@ -4568,6 +4568,11 @@ class H5PContentValidator {
'type' => 'text', 'type' => 'text',
'widget' => 'none' 'widget' => 'none'
), ),
(object) array(
'name' => 'defaultLanguage',
'type' => 'text',
'widget' => 'none'
)
); );
return $semantics; return $semantics;