Use image repository in theme settings inside html editor

Use image repository in theme settings inside html editor

Iban Cardona i Subiela -
回帖数:8

Hello,

I want to create a moodle theme with a setting with "admin_setting_confightmleditor". But when I render settings page of that theme, I can't upload images in the html editor. I can add only an image URL.

Any solution?

Thank you so much!

回复Iban Cardona i Subiela

Re: Use image repository in theme settings inside html editor

Richard Oelmann -
Core developers的头像 Plugin developers的头像 Testers的头像
回复Richard Oelmann

Re: Use image repository in theme settings inside html editor

Iban Cardona i Subiela -

Hello Richard,

I think that in that link there isn't any solution to the problem.

Thanks,
Iban Cardona.

回复Iban Cardona i Subiela

Re: Use image repository in theme settings inside html editor

Mary Evans -

Hi,

I stead of making the area a setting, you could just as easily make it a block region, where you can invite Admins to add an HTML block that is totally customisable.

Rocket theme is a good example of this.

Cheers

Mary

回复Mary Evans

Re: Use image repository in theme settings inside html editor

Iban Cardona i Subiela -
回复Iban Cardona i Subiela

Re: Use image repository in theme settings inside html editor

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

Hi Iban Cardona,

Interesting solution.  There is something in the back of my mind (after having had a previous issue with the Grid format) that draft files expire after a certain time - perhaps 60 days - so you may find that they disappear unexpectedly in the future.  I'm not that familiar with the File API, but perhaps that is something to double check.

Cheers,

Gareth

回复Gareth J Barnard

Re: Use image repository in theme settings inside html editor

Emma Richardson -
Documentation writers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

I use the main menu block on the front page.  Upload the images that I want to use - then I have the link.  Then I just delete the block which orphans it and am able to use the images.

回复Gareth J Barnard

Re: Use image repository in theme settings inside html editor

Iban Cardona i Subiela -

Hi Gareth,

I didn't know that draft files disappeared after 60 days... But in my solution I try to move files from draft to another location:

$newfile = $fs->create_file_from_storedfile($file_record, $file);

I hope this is enough to prevent files disappear... What do you think?

Best regards,
Iban Cardona.

回复Iban Cardona i Subiela

Re: Use image repository in theme settings inside html editor

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

Hi Iban Cardona,

As I said "I'm not that familiar with the File API" so could not really comment.  I just have different experience with the Grid format that is related but that was ages ago, so would take time to relearn what I coded.

Kind regards,

Gareth