jDownloadsownloads.com

Author Topic: Add custom css file to content plugin  (Read 351 times)

0 Members and 1 Guest are viewing this topic.

Offline HerKle

  • Jr. Member
  • **
  • Posts: 50
  • Style is poor man's basic right.
    • Alkoholpolitik
Add custom css file to content plugin
« on: 17.02.2021 22:10:58 »
Hi,

the plugin does not use the jdownloads_custom.css file so that its code has to be duplicated either into a new own file only for the plugin or integrated into joomla template user css. Duplication could be avoided if you integrate the custom.css file into the plugin itself.

At line 139 of plugins/content/jdownloads/jdownloads.php should be added
Code: [Select]
$custom_css_path = JPATH_ROOT.'/components/com_jdownloads/assets/css/jdownloads_custom.css';
if (JFile::exists('$custom_css_path')) {
$document->addStyleSheet(JURI::base().'components/com_jdownloads/assets/css/jdownloads_custom.css', "text/css", null, array());
}
I did it and it worked – but it might be lost by a future update of jD component. So I copied that file into a backup file to be able to reintegrate my changes into a new version of that file.
Kind regards, Herbert

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Add custom css file to content plugin
« Reply #1 on: 21.02.2021 12:08:46 »
HiThanks
Sounds a usefull addition and will review for a future updateColin

Offline HerKle

  • Jr. Member
  • **
  • Posts: 50
  • Style is poor man's basic right.
    • Alkoholpolitik
Re: Add custom css file to content plugin
« Reply #2 on: 21.02.2021 14:12:03 »
Hi Colin,
I am missing the Thank-you-button in this forum layout – so I thank you here and thumbs up!
Kind regards, Herbert

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Add custom css file to content plugin
« Reply #3 on: 22.02.2021 16:17:10 »
Herbert
Which version of jD are you using?
I checked out the code (as we are getting jD3.9.8 ready) and around line 161 the Content plugin loads the jD custom.css file  - this is in jD3.9.7.2
Could you check.  It only gets loaded if the page has jD content such as the content plugin or a module or similar
Colin

Offline HerKle

  • Jr. Member
  • **
  • Posts: 50
  • Style is poor man's basic right.
    • Alkoholpolitik
Re: Add custom css file to content plugin
« Reply #4 on: 22.02.2021 16:39:28 »
Hi Colin,
I didn't expect it to come that late, because in line 139 the decision between default and own css is taken. If I used own.css file, it would then be overwrtten again by custom.css. To me that feels not sound. That's why i put custom.css together with default before the else option of own css. And yes, I use jd 3.9.7.2, too.

So I would change my suggestion to move line 161-164 to line 139.

 :)
Kind regards, Herbert

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Add custom css file to content plugin
« Reply #5 on: 25.02.2021 09:32:03 »
HiWhat it means is that you can have both but the custom css would be the last one loaded so it would fulfill its primary objective function of selectively overriding specific parts of css files loaded earlier.  Own CSS might be from some other extension develpoer or template provider.
Best wishesColin