Skip to content
Snippets Groups Projects
Commit 7d4e7a5c authored by paalj's avatar paalj
Browse files

Fix indentation

parent 97c9cfa9
No related branches found
Tags 7.x-1.40
No related merge requests found
......@@ -809,57 +809,57 @@ class H5PDrupal implements H5PFrameworkInterface {
*/
public function loadContent($id) {
$content = db_query(
"SELECT hn.content_id AS id,
hn.json_content AS params,
hn.embed_type,
n.title,
n.language,
hl.library_id,
hl.machine_name AS library_name,
hl.major_version AS library_major_version,
hl.minor_version AS library_minor_version,
hl.embed_types AS library_embed_types,
hl.fullscreen AS library_fullscreen,
hn.filtered,
hn.disable,
hn.slug,
hn.authors AS meta_authors,
hn.source AS meta_source,
hn.license AS meta_license,
hn.license_version AS meta_license_version,
hn.license_extras AS meta_license_extras,
hn.year_from AS meta_year_from,
hn.year_to AS meta_year_to,
hn.changes AS meta_changes,
hn.author_comments AS meta_author_comments
FROM {h5p_nodes} hn
JOIN {node} n ON n.nid = hn.nid
JOIN {h5p_libraries} hl ON hl.library_id = hn.main_library_id
WHERE content_id = :id",
array(
':id' => $id
))
->fetchObject();
"SELECT hn.content_id AS id,
hn.json_content AS params,
hn.embed_type,
n.title,
n.language,
hl.library_id,
hl.machine_name AS library_name,
hl.major_version AS library_major_version,
hl.minor_version AS library_minor_version,
hl.embed_types AS library_embed_types,
hl.fullscreen AS library_fullscreen,
hn.filtered,
hn.disable,
hn.slug,
hn.authors AS meta_authors,
hn.source AS meta_source,
hn.license AS meta_license,
hn.license_version AS meta_license_version,
hn.license_extras AS meta_license_extras,
hn.year_from AS meta_year_from,
hn.year_to AS meta_year_to,
hn.changes AS meta_changes,
hn.author_comments AS meta_author_comments
FROM {h5p_nodes} hn
JOIN {node} n ON n.nid = hn.nid
JOIN {h5p_libraries} hl ON hl.library_id = hn.main_library_id
WHERE content_id = :id",
array(
':id' => $id
)
)->fetchObject();
if ($content === FALSE) {
return NULL;
}
if ($content === FALSE) {
return NULL;
}
// Build metadata object
$content->metadata = array();
foreach(array('authors', 'source', 'license', 'license_version', 'license_extras' ,'year_from', 'year_to', 'changes', 'author_comments') as $value) {
$lookup = 'meta_' . $value;
if (isset($content->$lookup)) {
$content->metadata[$value] = $content->$lookup;
// These fields are used to store complex data and need to be "extended"
if ($value === 'authors' || $value === 'changes' ) {
$content->metadata[$value] = json_decode($content->metadata[$value]);
}
unset($content->$lookup);
// Build metadata object
$content->metadata = array();
foreach(array('authors', 'source', 'license', 'license_version', 'license_extras' ,'year_from', 'year_to', 'changes', 'author_comments') as $value) {
$lookup = 'meta_' . $value;
if (isset($content->$lookup)) {
$content->metadata[$value] = $content->$lookup;
// These fields are used to store complex data and need to be "extended"
if ($value === 'authors' || $value === 'changes' ) {
$content->metadata[$value] = json_decode($content->metadata[$value]);
}
unset($content->$lookup);
}
$content->metadata['title'] = $content->title;
$content->metadata = H5PCore::snakeToCamel($content->metadata);
}
$content->metadata['title'] = $content->title;
$content->metadata = H5PCore::snakeToCamel($content->metadata);
return H5PCore::snakeToCamel($content);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment