Regenerate export if missing on view
Thanks to paravibe on Drupal.org for contributing.pull/28/head
parent
263a987eeb
commit
1c5b9707e5
|
@ -151,6 +151,17 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given export file exists
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function hasExport($filename) {
|
||||||
|
$target = "{$this->path}/exports/{$filename}";
|
||||||
|
return file_exists($target);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will concatenate all JavaScrips and Stylesheets into two files in order
|
* Will concatenate all JavaScrips and Stylesheets into two files in order
|
||||||
* to improve page performance.
|
* to improve page performance.
|
||||||
|
|
|
@ -90,6 +90,14 @@ interface H5PFileStorage {
|
||||||
*/
|
*/
|
||||||
public function deleteExport($filename);
|
public function deleteExport($filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given export file exists
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function hasExport($filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will concatenate all JavaScrips and Stylesheets into two files in order
|
* Will concatenate all JavaScrips and Stylesheets into two files in order
|
||||||
* to improve page performance.
|
* to improve page performance.
|
||||||
|
|
|
@ -1812,7 +1812,10 @@ class H5PCore {
|
||||||
* @return Object NULL on failure.
|
* @return Object NULL on failure.
|
||||||
*/
|
*/
|
||||||
public function filterParameters(&$content) {
|
public function filterParameters(&$content) {
|
||||||
if (isset($content['filtered']) && $content['filtered'] !== '') {
|
if (!empty($content['filtered']) &&
|
||||||
|
(!$this->exportEnabled ||
|
||||||
|
($content['slug'] &&
|
||||||
|
$this->fs->hasExport($content['slug'] . '-' . $content['id'] . '.h5p')))) {
|
||||||
return $content['filtered'];
|
return $content['filtered'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue