Theme setting - File not Found

Theme setting - File not Found

by Samuel Pérez -
Number of replies: 0

Hello everyone.

Moodle version 3.5.

Theme - Boost child.


I'm making a customizable Slider from the settings of the theme. I have everything configured, the file is uploaded correctly and appears in the database but the url gives error, "file not found" appears.

This is the url that returns:

//myserver.com/pluginfile.php/1/theme_themename/frontpageslider01image/1533138164/image_2.png

This is my code:


function

public function sliderfunction(){
global $PAGE,$COURSE;

$theme = theme_config::load('themename');
$imageurl = $theme->setting_file_url('frontpageslider01image', 'frontpageslider01image');
$slider = <img src="' . $imageurl . '" alt="Description">;

return $slider;
}





setting
$name = 'theme_themename/frontpageslider01image';
$title = get_string('frontpageslider01image', 'theme_themename');
$description = get_string('frontpageslider01image_desc', 'theme_themename');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpageslider01image');
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);

Thank you very much!

Average of ratings: -